Class: Query::Node::Boolean

Inherits:
Query::Node show all
Defined in:
lib/query/node/boolean.rb

Constant Summary collapse

BOOLEANS =
{
  "true" => true,
  "t" => true,
  "True" => true,
  "TRUE" => true,
  "T" => true,
  "yes" => true,
  "y" => true,
  "Yes" => true,
  "YES" => true,
  "Y" => true,
  "on" => true,
  "On" => true,
  "ON" => true,
  "false" => false,
  "f" => false,
  "False" => false,
  "FALSE" => false,
  "F" => false,
  "no" => false,
  "n" => false,
  "No" => false,
  "NO" => false,
  "N" => false,
  "off" => false,
  "Off" => false,
  "OFF" => false
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed) ⇒ Boolean

Returns a new instance of Boolean.



37
38
39
# File 'lib/query/node/boolean.rb', line 37

def initialize(parsed)
  self.boolean = parsed
end

Instance Attribute Details

#booleanObject

Returns the value of attribute boolean.



6
7
8
# File 'lib/query/node/boolean.rb', line 6

def boolean
  @boolean
end

Instance Method Details

#evaluate(**args) ⇒ Object



41
42
43
# File 'lib/query/node/boolean.rb', line 41

def evaluate(**args)
  BOOLEANS.fetch(boolean)
end