| Class | Pry::WrappedModule |
| In: |
lib/pry/module_candidate.rb
lib/pry/wrapped_module.rb |
| Parent: | Object |
| wrapped | [R] |
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")
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
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).
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
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.
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.