Class: KDL::Tokenizer::Token
- Inherits:
-
Object
- Object
- KDL::Tokenizer::Token
- Defined in:
- lib/kdl/tokenizer.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type, value, line, column, meta = {}) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(type, value, line, column, meta = {}) ⇒ Token
Returns a new instance of Token.
14 15 16 17 18 19 20 |
# File 'lib/kdl/tokenizer.rb', line 14 def initialize(type, value, line, column, = {}) @type = type @value = value @line = line @column = column @meta = end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
12 13 14 |
# File 'lib/kdl/tokenizer.rb', line 12 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
12 13 14 |
# File 'lib/kdl/tokenizer.rb', line 12 def line @line end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
12 13 14 |
# File 'lib/kdl/tokenizer.rb', line 12 def @meta end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/kdl/tokenizer.rb', line 12 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
12 13 14 |
# File 'lib/kdl/tokenizer.rb', line 12 def value @value end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 25 26 |
# File 'lib/kdl/tokenizer.rb', line 22 def ==(other) return false unless other.is_a?(Token) type == other.type && value == other.value && line == other.line && column == other.column end |
#to_s ⇒ Object Also known as: inspect
28 29 30 |
# File 'lib/kdl/tokenizer.rb', line 28 def to_s "#{value.inspect} (#{line}:#{column})" end |