Class: OpenEHR::AQL::Token
- Inherits:
-
Object
- Object
- OpenEHR::AQL::Token
- Defined in:
- lib/openehr/aql/lexer.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(type, value, line:, column:) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type, value, line:, column:) ⇒ Token
Returns a new instance of Token.
24 25 26 27 28 29 30 |
# File 'lib/openehr/aql/lexer.rb', line 24 def initialize(type, value, line:, column:) @type = type @value = value @line = line @column = column freeze end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
22 23 24 |
# File 'lib/openehr/aql/lexer.rb', line 22 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
22 23 24 |
# File 'lib/openehr/aql/lexer.rb', line 22 def line @line end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
22 23 24 |
# File 'lib/openehr/aql/lexer.rb', line 22 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
22 23 24 |
# File 'lib/openehr/aql/lexer.rb', line 22 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
32 33 34 |
# File 'lib/openehr/aql/lexer.rb', line 32 def ==(other) other.is_a?(Token) && type == other.type && value == other.value end |
#hash ⇒ Object
37 38 39 |
# File 'lib/openehr/aql/lexer.rb', line 37 def hash [type, value].hash end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/openehr/aql/lexer.rb', line 41 def to_s "#{type}(#{value.inspect})@#{line}:#{column}" end |