Class: CompactData::Tokeniser::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/compactdata/tokeniser/tokeniser.rb

Overview

A class to represent CompactData tokens

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, from, to) ⇒ Token

Returns a new instance of Token.



12
13
14
15
16
17
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 12

def initialize(type, value, from, to)
  @type = type
  @value = value
  @from = from
  @to = to
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



10
11
12
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 10

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



10
11
12
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 10

def to
  @to
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 10

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 10

def value
  @value
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/compactdata/tokeniser/tokeniser.rb', line 19

def to_s
  "type: #{@type}, from: #{@from}, to: #{@to}, value: \"#{@value}\""
end