class Leftovers::Definition
Attributes
location_s[R]
name[R]
names[R]
source_line[R]
test[R]
test?[R]
Public Class Methods
new( name, location: method_node.loc.expression, test: method_node.test_line? )
click to toggle source
# File lib/leftovers/definition.rb, line 10 def initialize( name, location: method_node.loc.expression, test: method_node.test_line? ) @name = name @path = location.source_buffer.name.to_s @source_line = location.source_line.to_s @location_column_range_begin = location.column_range.begin.to_i @location_column_range_end = location.column_range.end.to_i @location_source = location.source.to_s @location_s = location.to_s @test = test freeze end
Public Instance Methods
highlighted_source(highlight = "\e[31m", normal = "\e[0m")
click to toggle source
# File lib/leftovers/definition.rb, line 31 def highlighted_source(highlight = "\e[31m", normal = "\e[0m") @source_line[0...@location_column_range_begin].lstrip + highlight + @location_source + normal + @source_line[@location_column_range_end..-1].rstrip end
in_collection?()
click to toggle source
# File lib/leftovers/definition.rb, line 37 def in_collection? Leftovers.collector.calls.include?(@name) || (@test && in_test_collection?) end
in_test_collection?()
click to toggle source
# File lib/leftovers/definition.rb, line 41 def in_test_collection? Leftovers.collector.test_calls.include?(@name) end
to_s()
click to toggle source
# File lib/leftovers/definition.rb, line 27 def to_s @name.to_s end