Class: Liquidscript::Scanner::Token

Inherits:
Object
  • Object
show all
Includes:
Enumerable, ICR::Representable
Defined in:
lib/liquidscript/scanner/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ICR::Representable

#to_a!, #to_ary, #to_yaml

Constructor Details

#initialize(type, value, line, column) ⇒ Token

Returns a new instance of Token.



15
16
17
18
19
20
# File 'lib/liquidscript/scanner/token.rb', line 15

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

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



10
11
12
# File 'lib/liquidscript/scanner/token.rb', line 10

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



9
10
11
# File 'lib/liquidscript/scanner/token.rb', line 9

def line
  @line
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/liquidscript/scanner/token.rb', line 7

def type
  @type
end

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/liquidscript/scanner/token.rb', line 8

def value
  @value
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/liquidscript/scanner/token.rb', line 30

def empty?
  false
end

#to_aObject



22
23
24
# File 'lib/liquidscript/scanner/token.rb', line 22

def to_a
  [@type, @value]
end

#type?(type) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/liquidscript/scanner/token.rb', line 26

def type?(type)
  @type == type
end