summaryrefslogtreecommitdiff
path: root/jni/ruby/lib/irb/cmd/help.rb
blob: 028cc3556a749bb0304f2769a279aa6f24e8138d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
#   help.rb - helper using ri
#       $Release Version: 0.9.6$
#       $Revision: 38358 $
#
# --
#
#
#

require 'rdoc/ri/driver'

require "irb/cmd/nop.rb"

# :stopdoc:
module IRB
  module ExtendCommand
    class Help<Nop
      begin
        Ri = RDoc::RI::Driver.new
      rescue SystemExit
      else
        def execute(*names)
          if names.empty?
            Ri.interactive
            return
          end
          names.each do |name|
            begin
              Ri.display_name(name.to_s)
            rescue RDoc::RI::Error
              puts $!.message
            end
          end
          nil
        end
      end
    end
  end
end
# :startdoc: