Class: BackgroundServices::DSL::TeamBuilder
- Inherits:
-
Object
- Object
- BackgroundServices::DSL::TeamBuilder
- Defined in:
- lib/background_services/dsl.rb
Instance Method Summary collapse
- #build ⇒ Object
- #group(*groups) ⇒ Object
- #host(*hosts) ⇒ Object
-
#initialize ⇒ TeamBuilder
constructor
A new instance of TeamBuilder.
- #service(name) ⇒ Object
- #size(size) ⇒ Object
- #tube(*tubes) ⇒ Object
Constructor Details
#initialize ⇒ TeamBuilder
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
#build ⇒ Object
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 |