class Keisan::Token

Attributes

string[R]

Public Class Methods

new(string) click to toggle source
# File lib/keisan/token.rb, line 5
def initialize(string)
  raise Exceptions::InvalidToken.new(string) unless string.match(regex)
  @string = string
end
regex() click to toggle source
# File lib/keisan/token.rb, line 22
def self.regex
  raise Exceptions::NotImplementedError.new(:regex)
end
type() click to toggle source
# File lib/keisan/token.rb, line 14
def self.type
  @type ||= Util.underscore(self.to_s.split("::").last).to_sym
end

Public Instance Methods

regex() click to toggle source
# File lib/keisan/token.rb, line 18
def regex
  self.class.regex
end
type() click to toggle source
# File lib/keisan/token.rb, line 10
def type
  self.class.type
end