class method
self.ranges
Ruby on Rails 8.0.4
Since v7.2.3Signature
self.ranges(filepath)
No documentation comment.
Parameters
-
filepathreq
Source
# File railties/lib/rails/test_unit/test_parser.rb, line 27
def self.ranges(filepath)
queue = [Prism.parse_file(filepath).value]
begins_to_ends = {}
while (node = queue.shift)
case node.type
when :def_node
begins_to_ends[node.location.start_line] = node.location.end_line
when :call_node
begins_to_ends[node.location.start_line] = node.location.end_line
end
queue.concat(node.compact_child_nodes)
end
begins_to_ends
end
Defined in railties/lib/rails/test_unit/test_parser.rb line 27
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::TestUnit::TestParser