class Rubydex::DisplayLocation
A one based location intended for display purposes. This is what should be used when displaying a location to users, like in CLIs
Public Class Methods
(Prism::Location prism_location, uri: String) → Location
Source
# File lib/rubydex/location.rb, line 86 def from_prism(prism_location, uri:) raise NotImplementedError, <<~MESSAGE Cannot convert Prism::Location directly to a Rubydex::DisplayLocation. Start with `Rubydex::Location.from_prism(...)` and then convert the resulting location with `to_display` MESSAGE end
Public Instance Methods
() → [String, Integer, Integer, Integer, Integer]
Source
# File lib/rubydex/location.rb, line 105 def comparable_values [@uri, @start_line - 1, @start_column - 1, @end_line - 1, @end_column - 1] end
Normalize to zero-based for comparison with Location
Source
# File lib/rubydex/location.rb, line 98 def to_display self end
Returns itself
→ String
Source
# File lib/rubydex/location.rb, line 110 def to_s "#{to_file_path}:#{@start_line}:#{@start_column}-#{@end_line}:#{@end_column}" end