Class: Homeostasis::Event

Inherits:
Stasis::Plugin
  • Object
show all
Defined in:
lib/homeostasis.rb

Instance Method Summary collapse

Constructor Details

#initialize(stasis) ⇒ Event

Returns a new instance of Event.



184
185
186
187
# File 'lib/homeostasis.rb', line 184

def initialize(stasis)
  @stasis = stasis
  reset
end

Instance Method Details

#after_all(&block) ⇒ Object



193
194
195
# File 'lib/homeostasis.rb', line 193

def after_all(&block)
  @afters << block
end

#after_all_sendObject



201
202
203
# File 'lib/homeostasis.rb', line 201

def after_all_send
  @afters.each { |b| @stasis.action.instance_eval(&b) }
end

#before_all(&block) ⇒ Object



189
190
191
# File 'lib/homeostasis.rb', line 189

def before_all(&block)
  @befores << block
end

#before_all_sendObject



197
198
199
# File 'lib/homeostasis.rb', line 197

def before_all_send
  @befores.each { |b| @stasis.action.instance_eval(&b) }
end

#resetObject



205
206
207
208
# File 'lib/homeostasis.rb', line 205

def reset
  @befores = []
  @afters = []
end