Sha256: 9861da0afcf003f84b07743f5f5ef90116dacfbf8fca191358dcc94e0497a5a6

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

unless (RUBY_VERSION[0,3] == '1.9')

  class UnboundMethod

    # Return the name of the method.
    # Is this already in 1.9+ ?
    #
    #   class X
    #     def foo; end
    #   end
    #
    #   meth = X.instance_method(:foo)
    #
    #   meth.name  #=> "foo"
    #
    # CREDIT: Trans

    def name
      i = to_s.rindex('#')
      to_s.slice(i+1...-1)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.5.0 lib/core/facets/unboundmethod/name.rb