Class: Autoscale::Agent::Configuration
- Inherits:
-
Object
- Object
- Autoscale::Agent::Configuration
show all
- Defined in:
- lib/autoscale/agent/configuration.rb
Defined Under Namespace
Classes: BlockMissingError, InvalidPlatformError, PlatformMissingError
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
18
19
20
21
22
23
24
25
|
# File 'lib/autoscale/agent/configuration.rb', line 18
def initialize(&block)
instance_eval(&block)
if Configuration.run?
web_dispatchers.run
worker_dispatchers.run
end
end
|
Class Attribute Details
.run=(value) ⇒ Object
11
12
13
|
# File 'lib/autoscale/agent/configuration.rb', line 11
def run=(value)
@run = value
end
|
Class Method Details
.run? ⇒ Boolean
13
14
15
|
# File 'lib/autoscale/agent/configuration.rb', line 13
def run?
!defined?(@run) || @run == true
end
|
Instance Method Details
#dispatch(token, &block) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/autoscale/agent/configuration.rb', line 47
def dispatch(token, &block)
if block
dispatch_worker(token, &block)
else
dispatch_web(token)
end
end
|
27
28
29
30
31
32
33
|
# File 'lib/autoscale/agent/configuration.rb', line 27
def platform(value = nil)
if value
@platform = validate_platform(value)
else
@platform || raise(PlatformMissingError)
end
end
|
#serve(token, &block) ⇒ Object
55
56
57
58
|
# File 'lib/autoscale/agent/configuration.rb', line 55
def serve(token, &block)
raise BlockMissingError, "missing block" unless block
worker_servers << WorkerServer.new(token, &block)
end
|
#web_dispatchers ⇒ Object
35
36
37
|
# File 'lib/autoscale/agent/configuration.rb', line 35
def web_dispatchers
@web_dispatchers ||= WebDispatchers.new
end
|
#worker_dispatchers ⇒ Object
39
40
41
|
# File 'lib/autoscale/agent/configuration.rb', line 39
def worker_dispatchers
@worker_dispatchers ||= WorkerDispatchers.new
end
|
#worker_servers ⇒ Object
43
44
45
|
# File 'lib/autoscale/agent/configuration.rb', line 43
def worker_servers
@worker_servers ||= WorkerServers.new
end
|