Class: MotherBrain::Gear::Service::ActionRunner Private
- Inherits:
-
Object
- Object
- MotherBrain::Gear::Service::ActionRunner
- Includes:
- MB::Mixin::Services
- Defined in:
- lib/mb/gears/service/action_runner.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: CleanRoom
Instance Attribute Summary collapse
- #environment ⇒ Object readonly private
- #environment_attributes ⇒ Object readonly private
- #node_attributes ⇒ Object readonly private
- #nodes ⇒ Object readonly private
- #service_recipe ⇒ Object readonly private
- #toggle_callbacks ⇒ Object readonly private
Instance Method Summary collapse
-
#add_environment_attribute(key, value, options = {}) ⇒ Object
private
Set an environment level attribute to the given value.
-
#add_node_attribute(key, value, options) ⇒ Object
private
Set a node level attribute on all nodes for this action to the given value.
-
#initialize(environment, nodes, &block) ⇒ ActionRunner
constructor
private
A new instance of ActionRunner.
- #reset(job) ⇒ Object private
- #run(job) ⇒ Object private
- #set_service_recipe(recipe) ⇒ Object private
Constructor Details
#initialize(environment, nodes, &block) ⇒ ActionRunner
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ActionRunner.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mb/gears/service/action_runner.rb', line 17 def initialize(environment, nodes, &block) @environment = environment @nodes = Array(nodes) @environment_attributes = Array.new @node_attributes = Array.new @toggle_callbacks = Array.new if block_given? dsl_eval(&block) end end |
Instance Attribute Details
#environment ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/mb/gears/service/action_runner.rb', line 8 def environment @environment end |
#environment_attributes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/mb/gears/service/action_runner.rb', line 12 def environment_attributes @environment_attributes end |
#node_attributes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/mb/gears/service/action_runner.rb', line 13 def node_attributes @node_attributes end |
#nodes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/mb/gears/service/action_runner.rb', line 9 def nodes @nodes end |
#service_recipe ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/mb/gears/service/action_runner.rb', line 11 def service_recipe @service_recipe end |
#toggle_callbacks ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/mb/gears/service/action_runner.rb', line 10 def toggle_callbacks @toggle_callbacks end |
Instance Method Details
#add_environment_attribute(key, value, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set an environment level attribute to the given value. The key is represented by a dotted path.
47 48 49 |
# File 'lib/mb/gears/service/action_runner.rb', line 47 def add_environment_attribute(key, value, = {}) @environment_attributes << { key: key, value: value, options: } end |
#add_node_attribute(key, value, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set a node level attribute on all nodes for this action to the given value. The key is represented by a dotted path.
59 60 61 |
# File 'lib/mb/gears/service/action_runner.rb', line 59 def add_node_attribute(key, value, ) @node_attributes << { key: key, value: value, options: } end |
#reset(job) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/mb/gears/service/action_runner.rb', line 30 def reset(job) toggle_callbacks.concurrent_map { |callback| callback.call(job) } end |
#run(job) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 |
# File 'lib/mb/gears/service/action_runner.rb', line 34 def run(job) set_node_attributes(job) set_environment_attributes(job) end |
#set_service_recipe(recipe) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/mb/gears/service/action_runner.rb', line 63 def set_service_recipe(recipe) @service_recipe = recipe end |