123456789_123456789_123456789_123456789_123456789_

Class: IRB::ExtendCommand::Help

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Nop
Instance Chain:
self, Nop
Inherits: IRB::ExtendCommand::Nop
Defined in: lib/irb/cmd/help.rb

Class Method Summary

Nop - Inherited

.category, .description,
.execute

See additional method definition at line 39.

.new, .string_literal?

Instance Attribute Summary

Nop - Inherited

Instance Method Summary

Constructor Details

This class inherits a constructor from IRB::ExtendCommand::Nop

Class Method Details

.transform_args(args)

[ GitHub ]

  
# File 'lib/irb/cmd/help.rb', line 20

def transform_args(args)
  # Return a string literal as is for backward compatibility
  if args.empty? || string_literal?(args)
    args
  else # Otherwise, consider the input as a String for convenience
    args.strip.dump
  end
end

Instance Method Details

#execute(*names)

[ GitHub ]

  
# File 'lib/irb/cmd/help.rb', line 33

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