Class: RSpec::Support::Source::Location
- Inherits:
-
Struct
- Object
- Struct
- RSpec::Support::Source::Location
- Includes:
- Comparable
- Defined in:
- lib/rspec/support/source/location.rb
Overview
Represents a source location of node or token.
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#line ⇒ Object
Returns the value of attribute line.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column
8 9 10 |
# File 'lib/rspec/support/source/location.rb', line 8 def column @column end |
#line ⇒ Object
Returns the value of attribute line
8 9 10 |
# File 'lib/rspec/support/source/location.rb', line 8 def line @line end |
Class Method Details
.location?(array) ⇒ Boolean
11 12 13 |
# File 'lib/rspec/support/source/location.rb', line 11 def self.location?(array) array.is_a?(Array) && array.size == 2 && array.all? { |e| e.is_a?(Integer) } end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 |
# File 'lib/rspec/support/source/location.rb', line 15 def <=>(other) line_comparison = (line <=> other.line) return line_comparison unless line_comparison == 0 column <=> other.column end |