Class: ConfCtl::Generation::UnifiedList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/confctl/generation/unified_list.rb

Instance Method Summary collapse

Constructor Details

#initializeUnifiedList

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

Parameters:



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

Parameters:



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

Parameters:



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

Parameters:



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_ifObject



49
50
51
# File 'lib/confctl/generation/unified_list.rb', line 49

def delete_if(&)
  generations.delete_if(&)
end

#eachObject



45
46
47
# File 'lib/confctl/generation/unified_list.rb', line 45

def each(&)
  generations.each(&)
end

#empty?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/confctl/generation/unified_list.rb', line 53

def empty?
  generations.empty?
end