class Jrr::Token

Attributes

category[R]
raw_value[R]
value[R]

Public Class Methods

new(category, value, raw_value=nil) click to toggle source
# File lib/jrr/token.rb, line 5
def initialize(category, value, raw_value=nil)
  @category = category
  @value = value
  @raw_value = raw_value
end

Public Instance Methods

==(other_token) click to toggle source
# File lib/jrr/token.rb, line 27
def ==(other_token)
  is?(other_token.category) && value == other_token.value
end
empty?() click to toggle source
# File lib/jrr/token.rb, line 19
def empty?
  length.zero?
end
is?(some_category) click to toggle source
# File lib/jrr/token.rb, line 23
def is?(some_category)
  category == some_category
end
length() click to toggle source
# File lib/jrr/token.rb, line 15
def length
  raw_value.to_s.length
end
to_s() click to toggle source
# File lib/jrr/token.rb, line 11
def to_s
  (raw_value || value).to_s
end