Method introspection question

Hello

Is there anyway to get back the definition of a method within a running
program [or irb session]?

For example, if I declare a method:

def hello
puts "Hello"
end

is there anything like hello.source to get back hello's code?

Thanks.

amrangaye wrote:

Hello

Is there anyway to get back the definition of a method within a running
program [or irb session]?

For example, if I declare a method:

def hello
puts "Hello"
end

is there anything like hello.source to get back hello's code?

Thanks

look at ParseTree or Scrit_lines__,
http://blog.zenspider.com/archives/parsetree/index.html
http://redhanded.hobix.com/inspect/whoaScript_lines__.html\.

amrangaye wrote:

Hello

Is there anyway to get back the definition of a method within a running
program [or irb session]?

For example, if I declare a method:

def hello
puts "Hello"
end

is there anything like hello.source to get back hello's code?

http://lazaridis.com/case/lang/ruby/base.html#sayYourClassCode

If you implement an solution, please contact me via private email, thus I can update the document.

This way evaluators (or users) can immediately detect (and use) the functionality.

Thanks.

..

ยทยทยท

--
http://lazaridis.com