Class: Autoscale::Agent::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/autoscale/agent/configuration.rb

Defined Under Namespace

Classes: BlockMissingError, InvalidPlatformError, PlatformMissingError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Configuration

Returns a new instance of Configuration.



10
11
12
# File 'lib/autoscale/agent/configuration.rb', line 10

def initialize(&block)
  instance_eval(&block)
end

Instance Attribute Details

#web_dispatcherObject (readonly)

Returns the value of attribute web_dispatcher.



22
23
24
# File 'lib/autoscale/agent/configuration.rb', line 22

def web_dispatcher
  @web_dispatcher
end

Instance Method Details

#dispatch(token, &block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/autoscale/agent/configuration.rb', line 32

def dispatch(token, &block)
  if block
    dispatch_worker(token, &block)
  else
    dispatch_web(token)
  end
end

#platform(value = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/autoscale/agent/configuration.rb', line 14

def platform(value = nil)
  if value
    @platform = validate_platform(value)
  else
    @platform || raise(PlatformMissingError)
  end
end

#serve(token, &block) ⇒ Object

Raises:



40
41
42
43
# File 'lib/autoscale/agent/configuration.rb', line 40

def serve(token, &block)
  raise BlockMissingError, "missing block" unless block
  worker_servers << WorkerServer.new(token, &block)
end

#worker_dispatchersObject



24
25
26
# File 'lib/autoscale/agent/configuration.rb', line 24

def worker_dispatchers
  @worker_dispatchers ||= WorkerDispatchers.new
end

#worker_serversObject



28
29
30
# File 'lib/autoscale/agent/configuration.rb', line 28

def worker_servers
  @worker_servers ||= WorkerServers.new
end