method

__method__

Importance_1
Ruby latest stable (v1_8_7_72) - 0 notes - Class: Kernel
__method__() public

Returns the name of the current method as a Symbol. If called from inside of an aliased method it will return the original nonaliased name. If called outside of a method, it returns nil.

  def foo
    __method__
  end
  alias bar foo

  foo                # => :foo
  bar                # => :foo
Show source
Register or log in to add new notes.