Class: Wongi::Engine::DSL::Action::StatementGenerator
- Inherits:
-
BaseAction
- Object
- BaseAction
- Wongi::Engine::DSL::Action::StatementGenerator
- Defined in:
- lib/wongi-engine/dsl/action/statement_generator.rb
Instance Attribute Summary
Attributes inherited from BaseAction
#name, #production, #rete, #rule
Instance Method Summary collapse
- #execute(token) ⇒ Object
-
#initialize(template) ⇒ StatementGenerator
constructor
A new instance of StatementGenerator.
Methods inherited from BaseAction
Methods included from CoreExt
Constructor Details
#initialize(template) ⇒ StatementGenerator
Returns a new instance of StatementGenerator.
9 10 11 12 |
# File 'lib/wongi-engine/dsl/action/statement_generator.rb', line 9 def initialize(template) super() @template = template end |
Instance Method Details
#execute(token) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wongi-engine/dsl/action/statement_generator.rb', line 14 def execute(token) # p execute: {token:} subject, predicate, object = template.resolve!(token) wme = WME.new(subject, predicate, object) wme = .find(wme) || wme production.tracer.trace(action: self, wme: wme) if production.tracer if should_assert?(wme, token) .assert(wme, generator: token) end end |