class Wongi::Engine::AssumingClause

Attributes

base_rule_name[R]

Public Class Methods

new(base_rule_name) click to toggle source
# File lib/wongi-engine/dsl/assuming.rb, line 11
def initialize(base_rule_name)
  @base_rule_name = base_rule_name
end

Public Instance Methods

compile(context) click to toggle source
# File lib/wongi-engine/dsl/assuming.rb, line 15
def compile(context)
  base_production = context.rete.productions[base_rule_name]
  raise UndefinedBaseRule, base_rule_name unless base_production
  raise DefinitionError, "'assuming' cannot be preceded by other matchers" unless context.node.root?
  raise StandardError, "missing base context" unless base_production.compilation_context

  base_production.compilation_context.dup
end