Sha256: ee059f5a21cf1efb7674a00d6b88773729ac66c4c8442db1bf3fbbc4d1e25974

Contents?: true

Size: 382 Bytes

Versions: 5

Compression:

Stored size: 382 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

5 entries across 5 versions & 2 rubygems

Version Path
facets-2.4.2 lib/core/facets/unboundmethod/name.rb
facets-2.4.3 lib/core/facets/unboundmethod/name.rb
facets-2.4.4 lib/core/facets/unboundmethod/name.rb
facets-2.4.5 lib/core/facets/unboundmethod/name.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/unboundmethod/name.rb