Class: WipeOut::Execution::Context
- Inherits:
-
Object
- Object
- WipeOut::Execution::Context
- Includes:
- Observable
- Defined in:
- lib/wipe_out/execution/context.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(plan, record, config = plan.config) ⇒ Context
constructor
A new instance of Context.
- #notify(name) ⇒ Object
- #run ⇒ Object
- #subexecution(sub_plan, record) ⇒ Object
Constructor Details
#initialize(plan, record, config = plan.config) ⇒ Context
Returns a new instance of Context.
9 10 11 12 13 14 15 |
# File 'lib/wipe_out/execution/context.rb', line 9 def initialize(plan, record, config = plan.config) @plan = plan @record = record @config = config add_observer(CallbacksObserver.new(plan.callbacks, self)) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/wipe_out/execution/context.rb', line 7 def config @config end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
7 8 9 |
# File 'lib/wipe_out/execution/context.rb', line 7 def plan @plan end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'lib/wipe_out/execution/context.rb', line 7 def record @record end |
Instance Method Details
#notify(name) ⇒ Object
23 24 25 26 |
# File 'lib/wipe_out/execution/context.rb', line 23 def notify(name) changed notify_observers(name) end |
#run ⇒ Object
17 18 19 20 21 |
# File 'lib/wipe_out/execution/context.rb', line 17 def run on_execute = plan.on_execute || config.default_on_execute on_execute.call(self) end |
#subexecution(sub_plan, record) ⇒ Object
28 29 30 |
# File 'lib/wipe_out/execution/context.rb', line 28 def subexecution(sub_plan, record) self.class.new(sub_plan, record, config) end |