Class: SyntaxTree::XML::Location
- Inherits:
-
Object
- Object
- SyntaxTree::XML::Location
- Defined in:
- lib/syntax_tree/xml/nodes.rb
Overview
A Location represents a position for a node in the source file.
Instance Attribute Summary collapse
-
#end_char ⇒ Object
readonly
Returns the value of attribute end_char.
-
#end_line ⇒ Object
readonly
Returns the value of attribute end_line.
-
#start_char ⇒ Object
readonly
Returns the value of attribute start_char.
-
#start_line ⇒ Object
readonly
Returns the value of attribute start_line.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(start_char:, end_char:, start_line:, end_line:) ⇒ Location
constructor
A new instance of Location.
- #to(other) ⇒ Object
Constructor Details
#initialize(start_char:, end_char:, start_line:, end_line:) ⇒ Location
Returns a new instance of Location.
9 10 11 12 13 14 |
# File 'lib/syntax_tree/xml/nodes.rb', line 9 def initialize(start_char:, end_char:, start_line:, end_line:) @start_char = start_char @end_char = end_char @start_line = start_line @end_line = end_line end |
Instance Attribute Details
#end_char ⇒ Object (readonly)
Returns the value of attribute end_char.
7 8 9 |
# File 'lib/syntax_tree/xml/nodes.rb', line 7 def end_char @end_char end |
#end_line ⇒ Object (readonly)
Returns the value of attribute end_line.
7 8 9 |
# File 'lib/syntax_tree/xml/nodes.rb', line 7 def end_line @end_line end |
#start_char ⇒ Object (readonly)
Returns the value of attribute start_char.
7 8 9 |
# File 'lib/syntax_tree/xml/nodes.rb', line 7 def start_char @start_char end |
#start_line ⇒ Object (readonly)
Returns the value of attribute start_line.
7 8 9 |
# File 'lib/syntax_tree/xml/nodes.rb', line 7 def start_line @start_line end |
Instance Method Details
#<=>(other) ⇒ Object
34 35 36 |
# File 'lib/syntax_tree/xml/nodes.rb', line 34 def <=>(other) start_char <=> other.start_char end |
#deconstruct_keys(keys) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/syntax_tree/xml/nodes.rb', line 16 def deconstruct_keys(keys) { start_char: start_char, end_char: end_char, start_line: start_line, end_line: end_line } end |