diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/cmd/help.rb | 23 | ||||
-rw-r--r-- | lib/irb/extend-command.rb | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb new file mode 100644 index 0000000000..73067f53c6 --- /dev/null +++ b/lib/irb/cmd/help.rb @@ -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 diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index cfb2c7c4be..491aa027ca 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -100,6 +100,9 @@ module IRB [:fg, NO_OVERRIDE]], [:irb_kill, :Kill, "irb/cmd/subirb", [:kill, OVERRIDE_PRIVATE_ONLY]], + + [:irb_help, :Help, "irb/cmd/help", + [:help, NO_OVERRIDE]], ] def EXCB.install_extend_commands |