class method
self.definition_for
Ruby on Rails 8.1.2
Since v7.2.3Signature
self.definition_for(method)
Helper to translate a method object into the path and line range where the method was defined.
Parameters
-
methodreq
Source
# File railties/lib/rails/test_unit/test_parser.rb, line 19
def self.definition_for(method)
filepath, start_line = method.source_location
@begins_to_ends[filepath] ||= ranges(filepath)
return unless end_line = @begins_to_ends[filepath][start_line]
[filepath, start_line..end_line]
end
Defined in railties/lib/rails/test_unit/test_parser.rb line 19
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::TestUnit::TestParser