Class: BackgroundServices::DSL::TeamBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/background_services/dsl.rb

Instance Method Summary collapse

Constructor Details

#initializeTeamBuilder

Returns a new instance of TeamBuilder.



34
35
36
37
38
39
40
# File 'lib/background_services/dsl.rb', line 34

def initialize
  @hosts  = Array.new
  @groups = Array.new
  @tubes  = Array.new
  @service = nil
  @size   = 2
end

Instance Method Details

#buildObject



57
58
59
60
61
# File 'lib/background_services/dsl.rb', line 57

def build
  raise "Missing service" if @service == nil
  raise "Must have at lease one host" if @hosts.empty?
  BackgroundServices::Team.new(@service, @size, @tubes, @groups, @hosts)
end

#group(*groups) ⇒ Object



44
45
46
# File 'lib/background_services/dsl.rb', line 44

def group(*groups)
  @groups += groups
end

#host(*hosts) ⇒ Object



41
42
43
# File 'lib/background_services/dsl.rb', line 41

def host(*hosts)
  @hosts += hosts
end

#service(name) ⇒ Object



50
51
52
# File 'lib/background_services/dsl.rb', line 50

def service(name)
  @service = name
end

#size(size) ⇒ Object



53
54
55
# File 'lib/background_services/dsl.rb', line 53

def size(size)
  @size = size
end

#tube(*tubes) ⇒ Object



47
48
49
# File 'lib/background_services/dsl.rb', line 47

def tube(*tubes)
  @tubes = tubes
end