其他分享
首页 > 其他分享> > irb

irb

作者:互联网

~/.irbrc

1.

require "irb/completion"

def ri(*names)
  system(%{ri #{names.map {|name| name.to_s}.join(" ")}})
end

leader=" "*IRB.name.length
IRB.conf[:PROMPT][:HORN]={
  :PROMPT_I=>"#{IRB.name}  --> ",
  :PROMPT_S=>"#{leader} -- ",
  :PROMPT_C=>"#{leader} --+ ",
  :RETURN=>"#{leader}    =>%s\n\n"
}
IRB.conf[:AUTO_INDENT]=true
puts `date`

使用 alias irb="irb --prompt horn"

2.

IRB.conf[:IRB_RC]=proc do |conf|
  leader=" * "*conf.irb_name.length
  conf.prompt_i="#{conf.irb_name} --> "
  conf.prompt_s=leader+' \-" '
  conf.prompt_c=leader+' \+ '
  conf.return_format=leader +" ==> %s\n\n"
  puts `date`
end

 

标签:prompt,name,leader,conf,IRB,irb
来源: https://www.cnblogs.com/Citizen/p/10467393.html