ruby - What alternatives to IRB are there? -


in python world, there number of alternative python interpreters add cool additional features. 1 particularly useful example bpython, adds dynamic syntax highlighting, automatically pulls documentation, , displays live autocomplete information. in ruby world, have yet uncover projects add basic irb interpreter subset of these features. not looking hard enough, or ruby community lacking?

what coincidence. rubyflow yesterday announced irbtools gem, meta-gem containing lots of cool irb enhancement gems. contains:

  • colorized , output comment wirb , fancy_irb
  • nice irb prompt , irb’s auto indention
  • includes stdlib’s fileutils: ls, cd, pwd, ln_s, rm, mkdir, touch, cat
  • many debugging helpers: ap, q, o, c, y, object#m, object#d
    • ap – awesome_print
    • qp, on 1 line
    • object#m – ordered method list (takes integer parameter: level of nesting)
    • object#d – puts object, returns self (using tap)
  • “magical” information constants: info, os, rubyversion, rubyengine
    • os.windows?
    • rubyengine.jruby?
    • rubyversion.is.at_least? 1.9
  • clipboard features: copy , paste
    • also available: copy_input , copy_output session history
  • call vim (or supported editor) edit file, close , gets loaded current irb session, powered interactive_editor
  • another way of live loading irb: sketches
  • highlight string olorize('string') or file ray('path'), powered coderay
  • displays activerecord database entries tables hirb
  • restart irb reset! or change ruby version use method , rvm!
  • includes current directory in load path (was removed in 1.9.2 security reasons, pretty annoying in irb)
  • shorter requiring this: rq:mathn
  • and rerquiring rrq
  • try included object#ri helper, powered ori!
  • access lot of more commands boson – call commands started

there nice screenshots on irbtools page. 1 nice thing each of utilities can stand on own, in case want cherry-pick 1 or 2 features.

2013 update

since wrote this, pry has become popular irb replacement. doesn't as irbtools out of box, extensible plugin gems add cool features. can browse source code unix directory:

pry(main)> cd fileutils pry(fileutils):1> show-method rm  from: /opt/ruby/lib/ruby/1.9.1/fileutils.rb @ line 556: number of lines: 10 owner: fileutils  def rm(list, options = {})   fu_check_options options, opt_table['rm']   list = fu_list(list)   fu_output_message "rm#{options[:force] ? ' -f' : ''} #{list.join ' '}" if options[:verbose]   return if options[:noop]    list.each |path|     remove_file path, options[:force]   end end pry(fileutils):2> 

you can browse ruby documentation, issue shell commands, , if you're rails user, can use pry-rails gem pry in rails console. there's way hook sinatra , use heroku.

there's ample documentation--there bunch of screencasts including railscast. it's worth looking into.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -