Class | UnboundMethod
In: | lib/core/facets/unboundmethod/arguments.rb lib/core/facets/unboundmethod/name.rb
Parent: | Object

### Methods

arguments name

### Public Instance methods

arguments()

Resolves the arguments of the method to have an identical signiture —useful for preserving arity.

      class X
        def foo(a, b); end
        def bar(a, b=1); end
      end

      foo_method = X.instance_method(:foo)
      foo_method.arguments   #=> "a0, a1"

      bar_method = X.instance_method(:bar)
      bar_method.arguments   #=> "a0, *args"

When defaults are used the arguments must end in "*args".

CREDIT: Trans

name()

Return the name of the method.

Be aware that in ruby 1.9 UnboundMethod#name is defined already, but it returns a Symbol not a String.

      class NameExample
        def foo; end
      end

      meth = NameExample.instance_method(:foo)

      meth.name.to_sym  #=> :foo

CREDIT: Trans

[Validate]