Hi, At Thu, 5 Feb 2004 21:05:39 +0900, Gavri Savio Fernandez wrote in [ruby-talk:91613]: > > From: Charles Comstock [mailto:cc1 / cec.wustl.edu] > > Subject: Irb Ri integration (Was: An assimilators guide to Python?) > > > > > > Now that we have alot of the standard docs in ri format available in > > general do we have any integration between ri and irb? That would be > > nice to be able to easily call them from within irb. I mean > > I suppose > > you could just call `ri Array` or whatever, but nonetheless it seems > > some integration is possible. > > it's a pending RCR > > http://rcrchive.net/rcr/RCR/RCR197 > Abstract: Add a help() function to irb that would invoke ri on any module. A quick hack.
Index: lib/irb/extend-command.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/extend-command.rb,v retrieving revision 1.4 diff -u -2 -p -d -r1.4 extend-command.rb --- lib/irb/extend-command.rb 29 Jul 2002 06:14:08 -0000 1.4 +++ lib/irb/extend-command.rb 5 Feb 2004 12:43:03 -0000 @@ -101,4 +101,7 @@ module IRB [:irb_kill, :Kill, "irb/cmd/subirb", [:kill, OVERRIDE_PRIVATE_ONLY]], + + [:irb_help, :Help, "irb/cmd/help", + [:help, NO_OVERRIDE]], ] Index: lib/irb/cmd/help.rb =================================================================== RCS file: lib/irb/cmd/help.rb diff -N lib/irb/cmd/help.rb --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/irb/cmd/help.rb 5 Feb 2004 12:48:02 -0000 @@ -0,0 +1,23 @@ +require 'rdoc/ri/ri_driver' + +module IRB + module ExtendCommand + module Help + begin + @ri = RiDriver.new + rescue SystemExit + else + def self.execute(context, *names) + names.each do |name| + begin + @ri.get_info_for(name.to_s) + rescue RiError + puts $!.message + end + end + nil + end + end + end + end +end
-- Nobu Nakada