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
469 470 471 |
# File 'lib/core/nodes.rb', line 469 def assert(fact) propagate_assert fact if match fact end |
#match(fact) ⇒ Object
473 474 475 476 477 478 479 |
# File 'lib/core/nodes.rb', line 473 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 |