Class: Rackdapter::Application
- Inherits:
-
Object
- Object
- Rackdapter::Application
- Defined in:
- lib/rackdapter/spawner.rb
Instance Attribute Summary collapse
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#balancer ⇒ Object
Returns the value of attribute balancer.
-
#base_port ⇒ Object
Returns the value of attribute base_port.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#instances ⇒ Object
Returns the value of attribute instances.
-
#log ⇒ Object
Returns the value of attribute log.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#ruby ⇒ Object
Returns the value of attribute ruby.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #all_instances(&block) ⇒ Object
- #app_instances ⇒ Object
-
#initialize(options = {}) ⇒ Application
constructor
A new instance of Application.
- #next_port ⇒ Object
- #ports ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Application
Returns a new instance of Application.
6 7 8 9 10 11 12 13 14 |
# File 'lib/rackdapter/spawner.rb', line 6 def initialize(={}) .each do |k,v| send("#{k.to_s}=".to_sym, v) end @app_instances = {} ports.each do |port| @app_instances[port] = ApplicationInstance.new(self, port) end end |
Instance Attribute Details
#backend ⇒ Object
Returns the value of attribute backend.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def backend @backend end |
#balancer ⇒ Object
Returns the value of attribute balancer.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def balancer @balancer end |
#base_port ⇒ Object
Returns the value of attribute base_port.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def base_port @base_port end |
#environment ⇒ Object
Returns the value of attribute environment.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def environment @environment end |
#instances ⇒ Object
Returns the value of attribute instances.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def instances @instances end |
#log ⇒ Object
Returns the value of attribute log.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def log @log end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def port @port end |
#ruby ⇒ Object
Returns the value of attribute ruby.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def ruby @ruby end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/rackdapter/spawner.rb', line 4 def type @type end |
Instance Method Details
#all_instances(&block) ⇒ Object
38 39 40 41 42 |
# File 'lib/rackdapter/spawner.rb', line 38 def all_instances(&block) @app_instances.each do |port,instance| instance.send(:instance_eval, &block) end end |
#app_instances ⇒ Object
16 17 18 |
# File 'lib/rackdapter/spawner.rb', line 16 def app_instances @app_instances end |
#next_port ⇒ Object
20 21 22 23 |
# File 'lib/rackdapter/spawner.rb', line 20 def next_port @balancer ||= ProxyBalancer.new(ports) @balancer.next_port end |
#ports ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/rackdapter/spawner.rb', line 25 def ports return @ports if @ports @ports = [] instances.times do |i| @ports << base_port + i end @ports end |