Class: Ruleby::Core::Node
Overview
Base Node class used by all nodes in the network that do some kind of matching.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Printable
Instance Method Summary collapse
-
#initialize(bucket) ⇒ Node
constructor
A new instance of Node.
-
#resolve(mr1, mr2) ⇒ Object
This method determines if all common tags have equal values.
Methods inherited from Printable
Constructor Details
#initialize(bucket) ⇒ Node
Returns a new instance of Node.
278 279 280 281 |
# File 'lib/core/nodes.rb', line 278 def initialize(bucket) super() @bucket = bucket end |
Instance Method Details
#resolve(mr1, mr2) ⇒ Object
This method determines if all common tags have equal values. If any values are not equal then the method returns false.
285 286 287 288 289 290 291 292 293 294 |
# File 'lib/core/nodes.rb', line 285 def resolve(mr1, mr2) mr1.variables.each_key do |t1| mr2.variables.each_key do |t2| if t2 == t1 && mr1.fact_hash[t1] != mr2.fact_hash[t2] return false end end end true end |