lib/pry-doc/pry_ext/method_info.rb
##
# Convert a method object into the `Class#method` string notation.
#
# @param [Method, UnboundMethod] meth
# @return [String] the method in string receiver notation
# @note This mess is needed to support all the modern Rubies. Somebody has
#   to figure out a better way to distinguish between class methods and
#   instance methods.
Convert a method object into the `Class#method` string notation.
Convert a method object into the ` Class#method ` string notation .
def receiver_notation_for(meth)
        match = meth.inspect.match(METHOD_INSPECT_PATTERN)
        owner = meth.owner.to_s.sub(/#<.+?:(.+?)>/, '\1')
        name = match[2]
        name.sub!('#', '.') if match[1] =~ /\A#<Class:/
        owner + name
      end
def receiver_notation_for ( meth ) match = meth . inspect . match ( METHOD_INSPECT_PATTERN ) owner = meth . owner . to_s . sub ( / #<.+?:(.+?)> / , '\1' ) name = match [ 2 ] name . sub! ( '#' , '.' ) if match [ 1 ] =~ / \A #<Class: / owner + name end
Convert a method object into the `Class#method` string notation.
Convert a method object into the ` Class#method ` string notation .
the method in string receiver notation
the method in string receiver notation
String
meth
None
note
This mess is needed to support all the modern Rubies. Somebody has to figure out a better way to distinguish between class methods and instance methods.
This mess is needed to support all the modern Rubies . Somebody has to figure out a better way to distinguish between class methods and instance methods .