Class | Pry::Method |
In: |
lib/pry/method.rb
|
Parent: | Object |
from_class | -> | from_module |
Get all of the instance methods of a `Class` or `Module` @param [Class,Module] klass @return [Array[Pry::Method]]
Get all of the methods on an `Object` @param [Object] obj @return [Array[Pry::Method]]
Given a `Binding`, try to extract the `::Method` it originated from and use it to instantiate a `Pry::Method`. Return `nil` if this isn‘t possible.
@param [Binding] b @return [Pry::Method, nil]
Given a `Class` or `Module` and the name of a method, try to instantiate a `Pry::Method` containing the instance method of that name. Return `nil` if no such method exists.
@param [Class, Module] klass @param [String] name @return [Pry::Method, nil]
Given an object and the name of a method, try to instantiate a `Pry::Method` containing the method of that name bound to that object. Return `nil` if no such method exists.
@param [Object] obj @param [String] name @return [Pry::Method, nil]
Given a string representing a method name and optionally a binding to search in, find and return the requested method wrapped in a `Pry::Method` instance.
@param [String, nil] name The name of the method to retrieve, or `nil` to
delegate to `from_binding` instead.
@param [Binding] target The context in which to search for the method. @param [Hash] options @option options [Boolean] :instance Look for an instance method if `name` doesn‘t
contain any context.
@option options [Boolean] :methods Look for a bound/singleton method if `name` doesn‘t
contain any context.
@return [Pry::Method, nil] A `Pry::Method` instance containing the requested
method, or `nil` if no method could be located matching the parameters.
Get every `Class` and `Module`, in order, that will be checked when looking for methods on instances of the given `Class` or `Module`. This does not treat singleton classes of classes specially. @param [Class, Module] klass @return [Array[Class, Module]]
A new instance of `Pry::Method` wrapping the given `::Method`, `UnboundMethod`, or `Proc`.
@param [::Method, UnboundMethod, Proc] method @param [Hash] known_info, can be used to pre-cache expensive to compute stuff. @return [Pry::Method]
Get every `Class` and `Module`, in order, that will be checked when looking for an instance method to call on this object. @param [Object] obj @return [Array[Class, Module]]
@return [String, nil] The documentation for the method, or `nil` if it‘s
unavailable.
@raise [CommandError] Raises when the method was defined in the REPL.
Get the name of the method as a String, regardless of the underlying Method#name type. @return [String]
Get the name of the method including the class on which it was defined. @example
method(:puts).method_name => "Kernel.puts"
@return [String]
@return [String, nil] The original name the method was defined under,
before any aliasing, or `nil` if it can't be determined.
@return [String] A representation of the method‘s signature, including its
name and parameters. Optional and "rest" parameters are marked with `*` and block parameters with `&`. If the parameter names are unavailable, they're given numbered names instead. Paraphrased from `awesome_print` gem.
@return [String, nil] The name of the file the method is defined in, or
`nil` if the filename is unavailable.
@return [Fixnum, nil] The line of code in `source_file` which begins
the method's definition, or `nil` if that information is unavailable.
@return [Range, nil] The range of lines in `source_file` which contain
the method's definition, or `nil` if that information is unavailable.
@return [Symbol] The source type of the method. The options are
`:ruby` for Ruby methods or `:c` for methods written in C.
@return [Pry::Method, nil] The wrapped method that is called when you
use "super" in the body of this method.
@return [Symbol] The visibility of the method. May be `:public`,
`:protected`, or `:private`.