Tagged With   gem:name=bond , lib:name=irb , post:lang=ruby , post:type=screencast

Screencast Of Argument Autocompletion for Methods in Irb

Bond, a gem to improve irb’s autocompletion, just hit version 0.2.0. With this version comes a completion configuration system similar to bash/zsh, more fixes to irb’s incorrect completions and most importantly, any method can have its arguments autocompleted! The screencast demonstrates most of this.

Screencast

Bond – Argument Autocompletion for Methods in Irb from cldwalker.

Screencast Notes

  • Bond.list_methods: Lists all methods (80+) that have argument autocompletion.
  • Examples of methods with argument completion: Kernel#require, Array#delete, Hash#[], Module#const_get, Object#instance_variable_get
  • Object#send: Exemplifies an argument completion that varies per argument. Can be used to invoke argument completions for private methods.
  • Rails examples: ActiveRecord::Base.attr_accessible, ActiveRecord::Base.create, ActiveRecord::Base.where, ActiveRecord::Base.all
  • Basic argument completion example: Bond.complete(:method=>"Array#jump") { %w{foo bar baz} }

Install

Install the gem with:

    sudo gem install bond

In your irbrc, replace irb’s completion (require ‘irb/completion’) with :

  require 'bond'
  Bond.start
  #Bond.start replaces require 'bond/completion' from previous bond versions

If using wirble, place the above after wirble.

Further Reading

Enjoyed this post? Tell others! hacker newsHacker News | twitterTwitter | DeliciousDelicious | redditReddit
blog comments powered by Disqus