问题
I'm starting out with Ruby and was wondering if there's an interactive console similar to Python's IDLE, you know, with context highlighting and autocompletion. I've tried IRB, but it's fairly spartan (although it gets the work done; no question about that). Googling hasn't helped. You guys have any suggestions?
回答1:
There are a lot of gems that add functionality to IRB (colored output, better history, formatted output, etc). Just search http://gemcutter.org for them. Next to that, IRB comes with tab-completion. Start it with "irb -r 'irb/completion'" or put
require 'irb/completion'
in your ~/.irbrc
回答2:
You should check pry . it is awesome . it includes syntax highlighting , tab completion and many other features .
回答3:
If you are a Vim user, you can run Vim within IRB by using the interactive editor gem. Even if you are not a Vim user, this gem apparently enables you to use any other text editor from inside IRB.
There is also a similar gem called sketches, but I have not tried it myself.
来源:https://stackoverflow.com/questions/3763140/idle-like-interactive-console-for-ruby