Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails get source method

class A
  def foo
  end
end

file, line = A.instance_method(:foo).source_location
# or
file, line = A.new.method(:foo).source_location
puts "Method foo is defined in #{file}, line #{line}"
# => "Method foo is defined in temp.rb, line 2"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #source #method
ADD COMMENT
Topic
Name
8+6 =