Class: Orchestra::RunList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/orchestra/run_list.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(steps, result) ⇒ RunList

Returns a new instance of RunList.



13
14
15
16
17
18
# File 'lib/orchestra/run_list.rb', line 13

def initialize steps, result
  @result = result
  @steps = steps
  @steps.freeze
  freeze
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/orchestra/run_list.rb', line 9

def result
  @result
end

Class Method Details

.build(steps, result, input_names) ⇒ Object



3
4
5
6
7
# File 'lib/orchestra/run_list.rb', line 3

def self.build steps, result, input_names
  builder = Builder.new result, input_names
  builder.merge! steps
  builder.build
end

Instance Method Details

#dependenciesObject



29
30
31
32
33
# File 'lib/orchestra/run_list.rb', line 29

def dependencies
  optional = collect_from_steps :optional_dependencies
  required = collect_from_steps :required_dependencies
  (optional + required).uniq
end

#each(&block) ⇒ Object



20
21
22
23
# File 'lib/orchestra/run_list.rb', line 20

def each &block
  return to_enum :each unless block_given?
  @steps.each &block
end

#optional_dependenciesObject



35
36
37
# File 'lib/orchestra/run_list.rb', line 35

def optional_dependencies
  collect_from_steps :optional_dependencies
end

#provisionsObject



39
40
41
# File 'lib/orchestra/run_list.rb', line 39

def provisions
  collect_from_steps :provisions
end

#required_dependenciesObject



43
44
45
46
# File 'lib/orchestra/run_list.rb', line 43

def required_dependencies
  required_deps = collect_from_steps :required_dependencies
  required_deps - optional_dependencies - provisions
end

#step_namesObject



25
26
27
# File 'lib/orchestra/run_list.rb', line 25

def step_names
  @steps.keys
end