Class Pry::WrappedModule
In: lib/pry/module_candidate.rb
lib/pry/wrapped_module.rb
Parent: Object

Methods

Included Modules

Helpers::BaseHelpers CodeObject::Helpers

Classes and Modules

Class Pry::WrappedModule::Candidate

Attributes

wrapped  [R] 

Public Class methods

Convert a string to a module.

@param [String] mod_name @param [Binding] target The binding where the lookup takes place. @return [Module, nil] The module or `nil` (if conversion failed). @example

  Pry::WrappedModule.from_str("Pry::Code")

@raise [ArgumentError] if the argument is not a `Module` @param [Module] mod

Public Instance methods

Return a candidate for this module of specified rank. A `rank` of 0 is equivalent to the ‘primary candidate’, which is the module definition with the highest number of methods. A `rank` of 1 is the module definition with the second highest number of methods, and so on. Module candidates are necessary as modules can be reopened multiple times and in multiple places in Ruby, the candidate API gives you access to the module definition representing each of those reopenings. @raise [Pry::CommandError] If the `rank` is out of range. That

  is greater than `number_of_candidates - 1`.

@param [Fixnum] rank @return [Pry::WrappedModule::Candidate]

@note On JRuby 1.9 and higher, in certain conditions, this method chucks

  away its ability to be quick (when there are lots of monkey patches,
  like in Rails). However, it should be efficient enough on other rubies.

@see github.com/jruby/jruby/issues/525 @return [Enumerator, Array] on JRuby 1.9 and higher returns Array, on

 other rubies returns Enumerator

Is this strictly a class? @return [Boolean]

Returns an array of the names of the constants accessible in the wrapped module. This avoids the problem of accidentally calling the singleton method `Module.constants`. @param [Boolean] inherit Include the names of constants from included

  modules?

Returns documentation for the module. This documentation is for the primary candidate, if you would like documentation for other candidates use `WrappedModule#candidate` to select the candidate you‘re interested in. @raise [Pry::CommandError] If documentation cannot be found. @return [String] The documentation for the module.

@return [String, nil] The associated file for the module (i.e

  the primary candidate: highest ranked monkeypatch).

@return [Fixnum, nil] The associated line for the module (i.e

  the primary candidate: highest ranked monkeypatch).

Forward method invocations to the wrapped module

The prefix that would appear before methods defined on this class.

i.e. the "String." or "String#" in String.new and String#initialize.

@return String

Is this strictly a module? (does not match classes) @return [Boolean]

The name of the Module if it has one, otherwise #<Class:0xf00>.

@return [String]

@return [Fixnum] The number of candidate definitions for the

  current module.

Is this a singleton class? @return [Boolean]

Get the instance associated with this singleton class.

@raise ArgumentError: tried to get instance of non singleton class

@return [Object]

Returns the source for the module. This source is for the primary candidate, if you would like source for other candidates use `WrappedModule#candidate` to select the candidate you‘re interested in. @raise [Pry::CommandError] If source cannot be found. @return [String] The source for the module.

source_file()

Alias for file

source_line()

Alias for line

Retrieve the source location of a module. Return value is in same format as Method#source_location. If the source location cannot be found this method returns `nil`.

@param [Module] mod The module (or class). @return [Array<String, Fixnum>, nil] The source location of the

  module (or class), or `nil` if no source location found.

@param [Fixnum] times How far to travel up the ancestor chain. @return [Pry::WrappedModule, nil] The wrapped module that is the

  superclass.
  When `self` is a `Module` then return the
  nth ancestor, otherwise (in the case of classes) return the
  nth ancestor that is a class.

@return [String] Return the YARD docs for this module.

@return [Boolean] Whether YARD docs are available for this module.

@return [String] Return the associated file for the

  module from YARD, if one exists.

@return [Fixnum] Return the associated line for the

  module from YARD, if one exists.

[Validate]