Sha256: 9c38fedef217c42471185a115f94a4f6f5a5466ced33aa809d3b47c938e3f158
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
module Dentaku class Token attr_reader :category, :raw_value, :value def initialize(category, value, raw_value = nil) @category = category @value = value @raw_value = raw_value end def to_s raw_value || value end def length raw_value.to_s.length end def empty? length.zero? end def operator? is?(:operator) end def grouping? is?(:grouping) end def open? grouping? && value == :open end def close? grouping? && value == :close end def is?(c) category == c end def ==(other) (category.nil? || other.category.nil? || category == other.category) && (value.nil? || other.value.nil? || value == other.value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dentaku-3.5.4 | lib/dentaku/token.rb |