Class: LXL::Parser::Token

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ Token

Returns a new instance of Token.



188
# File 'lib/lxl.rb', line 188

def initialize(type, value) @type = type; @value = value end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



187
188
189
# File 'lib/lxl.rb', line 187

def type
  @type
end

#valueObject

Returns the value of attribute value.



187
188
189
# File 'lib/lxl.rb', line 187

def value
  @value
end

Instance Method Details

#to_sObject Also known as: inspect



190
# File 'lib/lxl.rb', line 190

def to_s() "T:#{@type.chr}:#{@value}" end

#whitespace?Boolean

Returns:

  • (Boolean)


189
# File 'lib/lxl.rb', line 189

def whitespace?() value.to_s.strip.empty? end