Class: KDL::Tokenizer::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/kdl/tokenizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, line, column, meta = {}) ⇒ Token



10
11
12
13
14
15
16
# File 'lib/kdl/tokenizer.rb', line 10

def initialize(type, value, line, column, meta = {})
  @type = type
  @value = value
  @line = line
  @column = column
  @meta = meta
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



8
9
10
# File 'lib/kdl/tokenizer.rb', line 8

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



8
9
10
# File 'lib/kdl/tokenizer.rb', line 8

def line
  @line
end

#metaObject (readonly)

Returns the value of attribute meta.



8
9
10
# File 'lib/kdl/tokenizer.rb', line 8

def meta
  @meta
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/kdl/tokenizer.rb', line 8

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/kdl/tokenizer.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
# File 'lib/kdl/tokenizer.rb', line 18

def ==(other)
  return false unless other.is_a?(Token)

  type == other.type && value == other.value && line == other.line && column == other.column
end

#to_sObject



24
25
26
# File 'lib/kdl/tokenizer.rb', line 24

def to_s
  "#{value.inspect} (#{line}:#{column})"
end