Class: Cadenza::BooleanInverseNode
- Inherits:
-
Object
- Object
- Cadenza::BooleanInverseNode
- Defined in:
- lib/cadenza/nodes/boolean_inverse_node.rb
Overview
The BooleanInverseNode takes an expression and evaluates the logical inverse of that expression so any expression that evaluates to true will return false and vice versa.
Instance Attribute Summary collapse
-
#expression ⇒ OperationNode
An evaluatable expression node.
Instance Method Summary collapse
-
#==(rhs) ⇒ Boolean
If the given BooleanInverseNode is equivalent by value.
-
#eval(context) ⇒ Object
The value of this node evaluated with the data in the given Context.
-
#initialize(expression) ⇒ BooleanInverseNode
constructor
creates a new BooleanInverseNode with the given expression.
Constructor Details
#initialize(expression) ⇒ BooleanInverseNode
creates a new Cadenza::BooleanInverseNode with the given expression
11 12 13 |
# File 'lib/cadenza/nodes/boolean_inverse_node.rb', line 11 def initialize(expression) @expression = expression end |
Instance Attribute Details
#expression ⇒ OperationNode
Returns an evaluatable expression node.
7 8 9 |
# File 'lib/cadenza/nodes/boolean_inverse_node.rb', line 7 def expression @expression end |
Instance Method Details
#==(rhs) ⇒ Boolean
Returns if the given Cadenza::BooleanInverseNode is equivalent by value.
17 18 19 |
# File 'lib/cadenza/nodes/boolean_inverse_node.rb', line 17 def ==(rhs) @expression == rhs.expression end |
#eval(context) ⇒ Object
Returns the value of this node evaluated with the data in the given Context.
23 24 25 26 |
# File 'lib/cadenza/nodes/boolean_inverse_node.rb', line 23 def eval(context) #TODO: rename me to .evaluate !@expression.eval(context) end |