Class: Rubydex::DisplayLocation

Inherits:
Location
  • Object
show all
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

Methods inherited from Location

#<=>, #initialize, #to_file_path

Constructor Details

This class inherits a constructor from Rubydex::Location

Instance Method Details

#comparable_valuesObject

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_displayObject

Returns itself

: () -> DisplayLocation



74
75
76
# File 'lib/rubydex/location.rb', line 74

def to_display
  self
end

#to_sObject

: -> 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