Class: Ruleby::Core::FunctionNode

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

Overview

This node class is used conditions that are simply a function, which returns true or false.

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, #initialize, #modify, #propagate, #propagate_assert, #propagate_modify, #propagate_retract, #retract

Methods inherited from Node

#initialize, #resolve

Methods inherited from Printable

#initialize, #print

Constructor Details

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

Instance Method Details

#assert(assertable) ⇒ Object



505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/core/nodes.rb', line 505

def assert(assertable)
  begin
    super if @atom.proc.call(assertable.fact.object, *@atom.arguments)
  rescue Exception => e
    @bucket.add_error Error.new(:proc_call, :error, {
        :object => fact.object.to_s,
        :function => true,
        :arguments => @atom.arguments,
        :message => e.message
    })
  end
end