Class: Homeostasis::Event
- Inherits:
-
Stasis::Plugin
- Object
- Stasis::Plugin
- Homeostasis::Event
- Defined in:
- lib/homeostasis.rb
Instance Method Summary collapse
- #after_all(&block) ⇒ Object
- #after_all_send ⇒ Object
- #before_all(&block) ⇒ Object
- #before_all_send ⇒ Object
-
#initialize(stasis) ⇒ Event
constructor
A new instance of Event.
- #reset ⇒ Object
Constructor Details
#initialize(stasis) ⇒ Event
Returns a new instance of Event.
189 190 191 192 |
# File 'lib/homeostasis.rb', line 189 def initialize(stasis) @stasis = stasis reset end |
Instance Method Details
#after_all(&block) ⇒ Object
198 199 200 |
# File 'lib/homeostasis.rb', line 198 def after_all(&block) @afters << block end |
#after_all_send ⇒ Object
206 207 208 |
# File 'lib/homeostasis.rb', line 206 def after_all_send @afters.each { |b| @stasis.action.instance_eval(&b) } end |
#before_all(&block) ⇒ Object
194 195 196 |
# File 'lib/homeostasis.rb', line 194 def before_all(&block) @befores << block end |
#before_all_send ⇒ Object
202 203 204 |
# File 'lib/homeostasis.rb', line 202 def before_all_send @befores.each { |b| @stasis.action.instance_eval(&b) } end |
#reset ⇒ Object
210 211 212 213 |
# File 'lib/homeostasis.rb', line 210 def reset @befores = [] @afters = [] end |