class Keisan::Tokens::LogicalOperator

Constants

AND
EQUAL
GREATER_THAN
GREATER_THAN_OR_EQUAL_TO
LESS_THAN
LESS_THAN_OR_EQUAL_TO
NOT
NOT_EQUAL
OR
REGEX

Public Class Methods

regex() click to toggle source
# File lib/keisan/tokens/logical_operator.rb, line 16
def self.regex
  REGEX
end

Public Instance Methods

operator_type() click to toggle source
# File lib/keisan/tokens/logical_operator.rb, line 20
def operator_type
  case string
  when LESS_THAN_OR_EQUAL_TO
    :<=
  when GREATER_THAN_OR_EQUAL_TO
    :>=
  when LESS_THAN
    :<
  when GREATER_THAN
    :>
  when AND
    :"&&"
  when OR
    :"||"
  when EQUAL
    :"=="
  when NOT_EQUAL
    :"!="
  when NOT
    string.count("!").even? ? :"!!" : :"!"
  end
end