Class: Wongi::Engine::AnyRule
- Inherits:
-
Object
- Object
- Wongi::Engine::AnyRule
- Defined in:
- lib/wongi-engine/dsl/any_rule.rb
Instance Attribute Summary collapse
-
#variants ⇒ Object
readonly
Returns the value of attribute variants.
Instance Method Summary collapse
- #import_into(rete) ⇒ Object
-
#initialize(&block) ⇒ AnyRule
constructor
A new instance of AnyRule.
- #option(&block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ AnyRule
Returns a new instance of AnyRule.
6 7 8 9 10 11 |
# File 'lib/wongi-engine/dsl/any_rule.rb', line 6 def initialize &block @variants = [] if block instance_eval &block end end |
Instance Attribute Details
#variants ⇒ Object (readonly)
Returns the value of attribute variants.
4 5 6 |
# File 'lib/wongi-engine/dsl/any_rule.rb', line 4 def variants @variants end |
Instance Method Details
#import_into(rete) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/wongi-engine/dsl/any_rule.rb', line 19 def import_into rete AnySet.new variants.map { |variant| if variant.respond_to? :import_into variant.import_into(rete) else variant end } end |
#option(&block) ⇒ Object
13 14 15 16 17 |
# File 'lib/wongi-engine/dsl/any_rule.rb', line 13 def option &block var = VariantRule.new var.instance_eval &block variants << var end |