Class: Rules::Trigger
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
Attributes inherited from Rule
Instance Method Summary collapse
- #execute!(object) ⇒ Object
-
#initialize(model, options, block) ⇒ Trigger
constructor
A new instance of Trigger.
Constructor Details
#initialize(model, options, block) ⇒ Trigger
Returns a new instance of Trigger.
5 6 7 8 |
# File 'lib/triggerable/rules/trigger.rb', line 5 def initialize model, , block super @callback = [:on] end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
3 4 5 |
# File 'lib/triggerable/rules/trigger.rb', line 3 def callback @callback end |
Instance Method Details
#execute!(object) ⇒ Object
10 11 12 |
# File 'lib/triggerable/rules/trigger.rb', line 10 def execute! object actions.each {|a| a.run_for!(object)} if condition.true_for?(object) end |