Class: RubyIndexer::Location
- Inherits:
-
Object
- Object
- RubyIndexer::Location
- Defined in:
- lib/ruby_indexer/lib/ruby_indexer/location.rb
Instance Attribute Summary collapse
-
#end_column ⇒ Object
readonly
: Integer.
-
#end_line ⇒ Object
readonly
: Integer.
-
#start_column ⇒ Object
readonly
: Integer.
-
#start_line ⇒ Object
readonly
: Integer.
Class Method Summary collapse
-
.from_prism_location(prism_location, code_units_cache) ⇒ Object
: (Prism::Location prism_location, (^(Integer arg0) -> Integer | Prism::CodeUnitsCache) code_units_cache) -> instance.
Instance Method Summary collapse
-
#==(other) ⇒ Object
: ((Location | Prism::Location) other) -> bool.
-
#initialize(start_line, end_line, start_column, end_column) ⇒ Location
constructor
: (Integer start_line, Integer end_line, Integer start_column, Integer end_column) -> void.
Constructor Details
#initialize(start_line, end_line, start_column, end_column) ⇒ Location
: (Integer start_line, Integer end_line, Integer start_column, Integer end_column) -> void
22 23 24 25 26 27 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 22 def initialize(start_line, end_line, start_column, end_column) @start_line = start_line @end_line = end_line @start_column = start_column @end_column = end_column end |
Instance Attribute Details
#end_column ⇒ Object (readonly)
: Integer
19 20 21 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 19 def end_column @end_column end |
#end_line ⇒ Object (readonly)
: Integer
19 20 21 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 19 def end_line @end_line end |
#start_column ⇒ Object (readonly)
: Integer
19 20 21 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 19 def start_column @start_column end |
#start_line ⇒ Object (readonly)
: Integer
19 20 21 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 19 def start_line @start_line end |
Class Method Details
.from_prism_location(prism_location, code_units_cache) ⇒ Object
: (Prism::Location prism_location, (^(Integer arg0) -> Integer | Prism::CodeUnitsCache) code_units_cache) -> instance
8 9 10 11 12 13 14 15 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 8 def from_prism_location(prism_location, code_units_cache) new( prism_location.start_line, prism_location.end_line, prism_location.cached_start_code_units_column(code_units_cache), prism_location.cached_end_code_units_column(code_units_cache), ) end |
Instance Method Details
#==(other) ⇒ Object
: ((Location | Prism::Location) other) -> bool
30 31 32 33 34 35 |
# File 'lib/ruby_indexer/lib/ruby_indexer/location.rb', line 30 def ==(other) start_line == other.start_line && end_line == other.end_line && start_column == other.start_column && end_column == other.end_column end |