class Dentaku::Token
Attributes
category[R]
raw_value[R]
value[R]
Public Class Methods
new(category, value, raw_value = nil)
click to toggle source
# File lib/dentaku/token.rb, line 5 def initialize(category, value, raw_value = nil) @category = category @value = value @raw_value = raw_value end
Public Instance Methods
==(other)
click to toggle source
# File lib/dentaku/token.rb, line 31 def ==(other) (category.nil? || other.category.nil? || category == other.category) && (value.nil? || other.value.nil? || value == other.value) end
empty?()
click to toggle source
# File lib/dentaku/token.rb, line 19 def empty? length.zero? end
grouping?()
click to toggle source
# File lib/dentaku/token.rb, line 23 def grouping? is?(:grouping) end
is?(c)
click to toggle source
# File lib/dentaku/token.rb, line 27 def is?(c) category == c end
length()
click to toggle source
# File lib/dentaku/token.rb, line 15 def length raw_value.to_s.length end
to_s()
click to toggle source
# File lib/dentaku/token.rb, line 11 def to_s raw_value || value end