# How to get the name of the executing method?

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-name-of-the-executing-method/89393>\
**Category:** Ruby\
**Created:** [March 20, 2007, 3:16am UTC](https://www.ruby-forum.com/t/how-to-get-the-name-of-the-executing-method/89393 "2007-03-20T03:16:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Griff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Griff](https://www.ruby-forum.com/u/Griff)\
**Post date:** [March 20, 2007, 3:16am UTC](https://www.ruby-forum.com/t/how-to-get-the-name-of-the-executing-method/89393/1 "2007-03-20T03:16:37Z")

</div>

How do I use reflection to get the name of the executing method?

---

<div class="post-metadata">

**Author:** ![Griff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Griff](https://www.ruby-forum.com/u/Griff)\
**Post date:** [March 20, 2007, 3:20am UTC](https://www.ruby-forum.com/t/how-to-get-the-name-of-the-executing-method/89393/2 "2007-03-20T03:20:37Z")

</div>

On 3/19/07, Griff [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do I use reflection to get the name of the executing method?

ri caller 🙂

---

<div class="post-metadata">

**Author:** ![Griff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Griff](https://www.ruby-forum.com/u/Griff)\
**Post date:** [March 20, 2007, 5:48am UTC](https://www.ruby-forum.com/t/how-to-get-the-name-of-the-executing-method/89393/3 "2007-03-20T05:48:52Z")

</div>

On Mar 19, 2007, at 10:15 PM, Griff wrote:

> How do I use reflection to get the name of the executing method?

There were two methods, **method** and **callee** in 1.9 for  
that provided this information. **method** returned the  
name used when the method was defined and **callee** provided  
the name used to call the method (i.e., via an alias).

They got lost in the merge of YARV into the 1.9 code base.  
I just posted a request to ruby-core to have them added back  
in.

If you’ve got two methods that only differ in how they  
interpret their arguments it might be nice to simply use  
the name of the alias to select the correct argument  
processing rather then having two methods that eventually  
make a call to a more generalized third method to do the  
work.

Gary W.
