0.0
No commit activity in last 3 years
No release in over 3 years
Add a source_location to method, allowing you to see the source code.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.7
~> 10.0
 Project Readme

SourceCode

Adds a source_code method to Method. This will allow you to view the source code of any Ruby method.

So let's say you have a method in a class like this:

class FancyClass

  def do_something
    1 + 1
  end

end

You've always been able to get a pointer to the method's source code like this:

FancyClass.new.method(:do_something).source_location
# ['fancy_class.rb', 3]

This gem adds .source_code, so you can see the source like this:

puts FancyClass.new.method(:do_something).source_code
#  def do_something
#    1 + 1
#  end