Pry::DefaultCommands::ModuleIntrospectionHelpers

For show-doc and show-source

Attributes

module_object[RW]

Public Instance Methods

attempt() click to toggle source
# File lib/pry/default_commands/introspection.rb, line 55
def attempt
  rank = 0
  begin
    yield(rank)
  rescue Pry::CommandError
    raise if rank > (module_object.number_of_candidates - 1)
    rank += 1
    retry
  end
end
method?() click to toggle source
# File lib/pry/default_commands/introspection.rb, line 14
def method?
  !!method_object
rescue CommandError
  false
end
module?(name) click to toggle source
# File lib/pry/default_commands/introspection.rb, line 10
def module?(name)
  self.module_object = Pry::WrappedModule.from_str(name, target)
end
module_start_line(mod, candidate_rank=0) click to toggle source
# File lib/pry/default_commands/introspection.rb, line 43
def module_start_line(mod, candidate_rank=0)
  if opts.present?(:'base-one')
    1
  else
    mod.candidate(candidate_rank).line
  end
end
process(name) click to toggle source
# File lib/pry/default_commands/introspection.rb, line 20
def process(name)
  if module?(name)
    code_or_doc = process_module
  elsif method?
    code_or_doc = process_method
  else
    code_or_doc = process_alternatives
  end

  render_output(code_or_doc, opts)
end
process_alternatives() click to toggle source
# File lib/pry/default_commands/introspection.rb, line 32
def process_alternatives
  if args.empty? && internal_binding?(target)
    mod = target_self.is_a?(Module) ? target_self : target_self.class
    self.module_object = Pry::WrappedModule(mod)

    process_module
  else
    process_method
  end
end
use_line_numbers?() click to toggle source
# File lib/pry/default_commands/introspection.rb, line 51
def use_line_numbers?
  opts.present?(:b) || opts.present?(:l)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.