Class: Madeleine::Executer
- Inherits:
-
Object
- Object
- Madeleine::Executer
- Defined in:
- lib/madeleine.rb
Overview
:nodoc:
Instance Method Summary collapse
- #execute(command) ⇒ Object
-
#initialize(system, context = nil) ⇒ Executer
constructor
:nodoc:.
- #recovery ⇒ Object
Constructor Details
#initialize(system, context = nil) ⇒ Executer
:nodoc:
183 184 185 186 187 |
# File 'lib/madeleine.rb', line 183 def initialize(system, context = nil) @system = system @context = context @in_recovery = false end |
Instance Method Details
#execute(command) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/madeleine.rb', line 189 def execute(command) begin if @context command.execute(@system, @context) else command.execute(@system) end rescue raise unless @in_recovery end end |
#recovery ⇒ Object
201 202 203 204 205 206 207 208 |
# File 'lib/madeleine.rb', line 201 def recovery begin @in_recovery = true yield ensure @in_recovery = false end end |