1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/irb/cmd/help.rb
Nobuyoshi Nakada 8760b270ed [ruby/irb] Move :stopdoc: directive
If this is at the top level, it stops the documentation of the
entire module, but not only the part in this file.

https://github.com/ruby/irb/commit/86c41b06ad
2022-03-14 14:40:28 +09:00

49 lines
962 B
Ruby

# frozen_string_literal: false
#
# help.rb - helper using ri
# $Release Version: 0.9.6$
# $Revision$
#
# --
#
#
#
require_relative "nop"
module IRB
# :stopdoc:
module ExtendCommand
class Help < Nop
def execute(*names)
require 'rdoc/ri/driver'
opts = RDoc::RI::Driver.process_args([])
IRB::ExtendCommand::Help.const_set(:Ri, RDoc::RI::Driver.new(opts))
rescue LoadError, SystemExit
IRB::ExtendCommand::Help.remove_method(:execute)
# raise NoMethodError in ensure
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
nil
ensure
execute(*names)
end
end
end
# :startdoc:
end