From: Eugene Ventimiglia Date: 2001-02-25T23:50:11+09:00 Subject: [ruby-talk:11532] vim macros for ri map \rb :!ruby % > /tmp/ruby.outs:e /tmp/ruby.out:!r m /tmp/ruby.out map \ri wb"zyw:!ruby //c/ruby/bin/ri.rb z > /tmp/ruby.out s:e /tmp/ruby.out:!rm /tmp/ruby.out change paths to suit: "//c/ruby/bin/ri.rb" and "/tmp" --e ----- Original Message ----- From: "Dave Thomas" To: "ruby-talk ML" ; Sent: Sunday, February 25, 2001 1:46 AM Subject: [ruby-talk:11511] ANN: ri - the Ruby Interactive reference > > Have you forgotten the parameters that each_with index passes to it's > block? Just type: > > % ri each_with_index > > and you'll see: > > ------------------------------------------------------------------ > enumObj.each_with_index {| obj, i | block } -> nil > ------------------------------------------------------------------ > Calls block with two arguments, the item and its index, for each > item in enumObj. > > hash = Hash.new > %w(cat dog wombat).each_with_index {|item, index| > hash[item] = index > } > hash #=> {"dog"=>1, "wombat"=>2, "cat"=>0} > > > Hazy on what methods are defined in the Math module? > > % ri Math > ------------------------------------------------------------------- > module: Math > ------------------------------------------------------------------- > The Math module contains module functions for basic trigonometric > and transcendental functions. > ------------------------------------------------------------------- > atan2, cos, exp, frexp, ldexp, log, log10, sin, sqrt, tan > ------------------------------------------------------------------- > > ri contains the information from Programming Ruby on 42 built-in > classes and modules, and over 700 built-in methods. What command line > could be complete without a copy of ri? > > Snag one while they last at: > > http://www.pragmaticprogrammer.com/ruby/downloads/ri.html > > > Dave > > > ps. > > If anyone writes editor macros that use ri, so that you can pop-up > method descriptions while your cursor is on the method name, I'd love > to add them to the distribution. Thanks. >