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, #initialize, #modify, #propagate, #propagate_assert, #propagate_modify, #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(assertable) ⇒ Object
556 557 558 |
# File 'lib/core/nodes.rb', line 556 def assert(assertable) propagate_assert assertable if match assertable.fact end |
#match(fact) ⇒ Object
560 561 562 563 564 565 566 |
# File 'lib/core/nodes.rb', line 560 def match(fact) args = [fact.object.send(@atom.slot)] @atom.vars.each do |var| args.push fact.object.send(var) end return @atom.proc.call(*args) end |