Class: Ruleby::Core::PropertyNode

Inherits:
AtomNode show all
Defined in:
lib/core/nodes.rb

Overview

This node class is used for matching properties of a fact.

Instance Attribute Summary

Attributes inherited from AtomNode

#atom

Attributes inherited from ParentNode

#child_nodes

Attributes inherited from Printable

#parent_nodes

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

#resolve

Methods inherited from Printable

#initialize, #print

Constructor Details

This class inherits a constructor from Ruleby::Core::AtomNode

Instance Method Details

#assert(fact) ⇒ Object



409
410
411
412
413
414
415
416
417
418
# File 'lib/core/nodes.rb', line 409

def assert(fact)
  begin
    val = fact.object.send(@atom.method)   
  rescue NoMethodError => e
    # If the method does not exist, it is the same as if it evaluted to 
    # false, and the network traverse stops
    return
  end
  super if @atom.proc.call(val)
end