Class: Code::Node::Boolean
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::Boolean
- Defined in:
- lib/code/node/boolean.rb
Constant Summary collapse
- TRUE_KEYWORD =
"true"- FALSE_KEYWORD =
"false"
Instance Method Summary collapse
- #evaluate(**_args) ⇒ Object
-
#initialize(parsed) ⇒ Boolean
constructor
A new instance of Boolean.
Methods inherited from Code::Node
Constructor Details
#initialize(parsed) ⇒ Boolean
Returns a new instance of Boolean.
9 10 11 12 13 |
# File 'lib/code/node/boolean.rb', line 9 def initialize(parsed) return if parsed.blank? @boolean = parsed.presence end |
Instance Method Details
#evaluate(**_args) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/code/node/boolean.rb', line 15 def evaluate(**_args) if @boolean == TRUE_KEYWORD Object::Boolean.new(true) elsif @boolean == FALSE_KEYWORD Object::Boolean.new(false) else Object::Nothing.new end end |