Class: ConfCtl::Generation::UnifiedList
- Inherits:
-
Object
- Object
- ConfCtl::Generation::UnifiedList
- Includes:
- Enumerable
- Defined in:
- lib/confctl/generation/unified_list.rb
Instance Method Summary collapse
- #add_build_generation(generation) ⇒ Object
- #add_build_generations(generations) ⇒ Object
- #add_host_generation(generation) ⇒ Object
- #add_host_generations(generations) ⇒ Object
- #delete_if ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ UnifiedList
constructor
A new instance of UnifiedList.
Constructor Details
#initialize ⇒ UnifiedList
Returns a new instance of UnifiedList.
3 4 5 |
# File 'lib/confctl/generation/unified_list.rb', line 3 def initialize @generations = [] end |
Instance Method Details
#add_build_generation(generation) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/confctl/generation/unified_list.rb', line 8 def add_build_generation(generation) unified = generations.detect { |g| g.includes?(generation) } if unified unified.build_generation = generation else generations << Generation::Unified.new(generation.host, build_generation: generation) end true end |
#add_build_generations(generations) ⇒ Object
21 22 23 24 |
# File 'lib/confctl/generation/unified_list.rb', line 21 def add_build_generations(generations) generations.each { |v| add_build_generation(v) } true end |
#add_host_generation(generation) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/confctl/generation/unified_list.rb', line 27 def add_host_generation(generation) unified = generations.detect { |g| g.includes?(generation) } if unified unified.host_generation = generation else generations << Generation::Unified.new(generation.host, host_generation: generation) end true end |
#add_host_generations(generations) ⇒ Object
40 41 42 43 |
# File 'lib/confctl/generation/unified_list.rb', line 40 def add_host_generations(generations) generations.each { |v| add_host_generation(v) } true end |
#delete_if ⇒ Object
49 50 51 |
# File 'lib/confctl/generation/unified_list.rb', line 49 def delete_if(&) generations.delete_if(&) end |
#each ⇒ Object
45 46 47 |
# File 'lib/confctl/generation/unified_list.rb', line 45 def each(&) generations.each(&) end |
#empty? ⇒ Boolean
53 54 55 |
# File 'lib/confctl/generation/unified_list.rb', line 53 def empty? generations.empty? end |