Sha256: 183aca878ab7bb43e93fb0cb8d3a4198a7cbf4c108e112e1e49b225c99273876

Contents?: true

Size: 402 Bytes

Versions: 3

Compression:

Stored size: 402 Bytes

Contents

# DEPRECATE for 1.9
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

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.2.0 lib/core/facets/unboundmethod/name.rb
facets-2.2.1 lib/core/facets/unboundmethod/name.rb
facets-2.3.0 lib/core/facets/unboundmethod/name.rb