Class: Ruleby::Ferrari::RulebookHelper
- Inherits:
-
Object
- Object
- Ruleby::Ferrari::RulebookHelper
- Defined in:
- lib/dsl/ferrari.rb
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
-
#initialize(engine) ⇒ RulebookHelper
constructor
A new instance of RulebookHelper.
- #rule(name, *args, &block) ⇒ Object
Constructor Details
#initialize(engine) ⇒ RulebookHelper
Returns a new instance of RulebookHelper.
15 16 17 |
# File 'lib/dsl/ferrari.rb', line 15 def initialize(engine) @engine = engine end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
19 20 21 |
# File 'lib/dsl/ferrari.rb', line 19 def engine @engine end |
Instance Method Details
#rule(name, *args, &block) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/dsl/ferrari.rb', line 21 def rule(name, *args, &block) = args[0].kind_of?(Hash) ? args.shift : {} rules = Ruleby::Ferrari.parse_containers(args, RulesContainer.new).build(name,,@engine,&block) rules.each do |r| engine.assert_rule(r) end end |