Class: Rubydex::DisplayLocation
- Defined in:
- lib/rubydex/location.rb
Overview
A one based location intended for display purposes. This is what should be used when displaying a location to users, like in CLIs
Instance Attribute Summary
Attributes inherited from Location
#end_column, #end_line, #start_column, #start_line, #uri
Instance Method Summary collapse
-
#comparable_values ⇒ Object
Normalize to zero-based for comparison with Location.
-
#to_display ⇒ Object
Returns itself.
-
#to_s ⇒ Object
: -> String.
Methods inherited from Location
#<=>, #initialize, #to_file_path
Constructor Details
This class inherits a constructor from Rubydex::Location
Instance Method Details
#comparable_values ⇒ Object
Normalize to zero-based for comparison with Location
: () -> [String, Integer, Integer, Integer, Integer]
81 82 83 |
# File 'lib/rubydex/location.rb', line 81 def comparable_values [@uri, @start_line - 1, @start_column - 1, @end_line - 1, @end_column - 1] end |
#to_display ⇒ Object
Returns itself
: () -> DisplayLocation
74 75 76 |
# File 'lib/rubydex/location.rb', line 74 def to_display self end |
#to_s ⇒ Object
: -> String
86 87 88 |
# File 'lib/rubydex/location.rb', line 86 def to_s "#{to_file_path}:#{@start_line}:#{@start_column}-#{@end_line}:#{@end_column}" end |