Class: Ruleby::Core::SelfReferenceNode
- Inherits:
-
AtomNode
- Object
- Printable
- Node
- ParentNode
- AtomNode
- Ruleby::Core::SelfReferenceNode
- Defined in:
- lib/core/nodes.rb
Overview
This node class is used to match properties of a fact with other properties of itself. Unlike ReferenceAtom it does perform inline matching.
Instance Attribute Summary
Attributes inherited from AtomNode
Attributes inherited from ParentNode
Attributes inherited from Printable
Instance Method Summary collapse
Methods inherited from AtomNode
#==, #initialize, #shareable?, #to_s
Methods inherited from ParentNode
#add_out_node, #forks?, #initialize, #propagate_assert, #propagate_retract, #retract
Methods inherited from Node
Methods inherited from Printable
Constructor Details
This class inherits a constructor from Ruleby::Core::AtomNode
Instance Method Details
#assert(fact) ⇒ Object
462 463 464 |
# File 'lib/core/nodes.rb', line 462 def assert(fact) propagate_assert fact if match fact end |
#match(fact) ⇒ Object
466 467 468 469 470 471 472 |
# File 'lib/core/nodes.rb', line 466 def match(fact) args = [fact.object.send(@atom.method)] @atom.vars.each do |var| args.push fact.object.send(var) end return @atom.proc.call(*args) end |