Class: AndNode
Overview
Logic Gate Nodes
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(lhs, rhs) ⇒ AndNode
constructor
A new instance of AndNode.
Methods inherited from Node
Constructor Details
#initialize(lhs, rhs) ⇒ AndNode
Returns a new instance of AndNode.
47 48 49 50 51 52 53 54 |
# File 'lib/nodes/basenodes.rb', line 47 def initialize(lhs, rhs) @lhs, @rhs = lhs, rhs if @rhs.class.method_defined? (:lhs) if @rhs.lhs == nil @rhs.lhs = @lhs.lhs end end end |
Instance Method Details
#evaluate ⇒ Object
56 57 58 |
# File 'lib/nodes/basenodes.rb', line 56 def evaluate @lhs.evaluate && @rhs.evaluate end |