Class: SlavePools::Pool
- Inherits:
-
Object
- Object
- SlavePools::Pool
- Defined in:
- lib/slave_pools/pool.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#slaves ⇒ Object
readonly
Returns the value of attribute slaves.
Instance Method Summary collapse
-
#initialize(name, connections) ⇒ Pool
constructor
A new instance of Pool.
- #next ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize(name, connections) ⇒ Pool
Returns a new instance of Pool.
5 6 7 8 9 10 |
# File 'lib/slave_pools/pool.rb', line 5 def initialize(name, connections) @name = name @slaves = connections @size = connections.size self.reset end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
3 4 5 |
# File 'lib/slave_pools/pool.rb', line 3 def current @current end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/slave_pools/pool.rb', line 3 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
3 4 5 |
# File 'lib/slave_pools/pool.rb', line 3 def size @size end |
#slaves ⇒ Object (readonly)
Returns the value of attribute slaves.
3 4 5 |
# File 'lib/slave_pools/pool.rb', line 3 def slaves @slaves end |
Instance Method Details
#next ⇒ Object
17 18 19 |
# File 'lib/slave_pools/pool.rb', line 17 def next @current = @cycle.next end |
#reset ⇒ Object
12 13 14 15 |
# File 'lib/slave_pools/pool.rb', line 12 def reset @cycle = slaves.cycle self.next end |