# Ruby reflection of methods

**URL:** <https://www.ruby-forum.com/t/ruby-reflection-of-methods/125309>\
**Category:** Ruby\
**Created:** [January 8, 2008, 4:43am UTC](https://www.ruby-forum.com/t/ruby-reflection-of-methods/125309 "2008-01-08T04:43:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![varac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c2a13f/32.png) [@varac](https://www.ruby-forum.com/u/varac)\
**Post date:** [January 8, 2008, 4:43am UTC](https://www.ruby-forum.com/t/ruby-reflection-of-methods/125309/1 "2008-01-08T04:43:17Z")

</div>

If I do something like:  
meth=method(:send) (or any other method)

is there anyway to get the actual text of the send method? like  
meth.body or something?

I don’t actually need the text of the method, I was just wondering.

Ray

---

<div class="post-metadata">

**Author:** ![varac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c2a13f/32.png) [@varac](https://www.ruby-forum.com/u/varac)\
**Post date:** [January 8, 2008, 4:47am UTC](https://www.ruby-forum.com/t/ruby-reflection-of-methods/125309/2 "2008-01-08T04:47:57Z")

</div>

> If I do something like:  
> meth=method(:send) (or any other method)
> 
> is there anyway to get the actual text of the send method? like  
> meth.body or something?
> 
> I don’t actually need the text of the method, I was just wondering.

There is such a way. Use the mighty and impressive Ruby2Ruby gem. It’s  
downright scary.

teh IRB session:

> > class RedWine  
> > def drink  
> > “glug”  
> > end  
> > end  
> > =\> nil  
> > @red\_wine = RedWine.new  
> > =\> #RedWine:0x1108514  
> > require ‘ruby2ruby’  
> > =\> true  
> > @red\_wine.method(:drink).to\_ruby  
> > =\> “def drink\n “glug”\nend”

–  
Giles B.

Podcast: [http://hollywoodgrit.blogspot.com](http://hollywoodgrit.blogspot.com)  
Blog: [http://gilesbowkett.blogspot.com](http://gilesbowkett.blogspot.com)  
Portfolio: [http://www.gilesgoatboy.org](http://www.gilesgoatboy.org)  
Tumblelog: [http://giles.tumblr.com](http://giles.tumblr.com)
