Class: Orchestra::Operation
- Inherits:
-
Module
- Object
- Module
- Orchestra::Operation
- Extended by:
- Forwardable
- Defined in:
- lib/orchestra/operation.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Class Method Summary collapse
Instance Method Summary collapse
- #command? ⇒ Boolean
- #execute(*args, &block) ⇒ Object
-
#initialize(args = {}) ⇒ Operation
constructor
A new instance of Operation.
- #process(output) ⇒ Object
- #start_execution(*args) {|execution| ... } ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Operation
Returns a new instance of Operation.
20 21 22 23 24 |
# File 'lib/orchestra/operation.rb', line 20 def initialize args = {} @result, @command, @steps = Util.extract_key_args args, :result, :command => false, :steps => {} @default_run_list = RunList.build steps, result, [] end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
18 19 20 |
# File 'lib/orchestra/operation.rb', line 18 def registry @registry end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
18 19 20 |
# File 'lib/orchestra/operation.rb', line 18 def result @result end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
18 19 20 |
# File 'lib/orchestra/operation.rb', line 18 def steps @steps end |
Class Method Details
.new(*args, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/orchestra/operation.rb', line 3 def self.new *args, &block return super unless block_given? unless args.empty? raise ArgumentError, "wrong number of arguments (#{args.size} for 0)" end builder = DSL::Operations::Builder.new DSL::Operations::Context.evaluate builder, &block builder.build_operation end |
Instance Method Details
#command? ⇒ Boolean
43 44 45 |
# File 'lib/orchestra/operation.rb', line 43 def command? @command ? true : false end |
#execute(*args, &block) ⇒ Object
30 31 32 33 34 |
# File 'lib/orchestra/operation.rb', line 30 def execute *args, &block execution = start_execution *args, &block output = execution.execute @command ? nil : output end |
#process(output) ⇒ Object
26 27 28 |
# File 'lib/orchestra/operation.rb', line 26 def process output output.select do |key, _| key = result end end |