Class: SlavePoolsModule::SlavePool
- Inherits:
-
Object
- Object
- SlavePoolsModule::SlavePool
- Defined in:
- lib/slave_pools/slave_pool.rb
Instance Attribute Summary collapse
-
#current_index ⇒ Object
Returns the value of attribute current_index.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pool_size ⇒ Object
Returns the value of attribute pool_size.
-
#slaves ⇒ Object
Returns the value of attribute slaves.
Instance Method Summary collapse
- #current ⇒ Object
-
#initialize(name, slaves) ⇒ SlavePool
constructor
A new instance of SlavePool.
- #next ⇒ Object
Constructor Details
#initialize(name, slaves) ⇒ SlavePool
Returns a new instance of SlavePool.
6 7 8 9 10 11 |
# File 'lib/slave_pools/slave_pool.rb', line 6 def initialize(name, slaves) @name = name @slaves = slaves @pool_size = @slaves.length @current_index = 0 end |
Instance Attribute Details
#current_index ⇒ Object
Returns the value of attribute current_index.
4 5 6 |
# File 'lib/slave_pools/slave_pool.rb', line 4 def current_index @current_index end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/slave_pools/slave_pool.rb', line 4 def name @name end |
#pool_size ⇒ Object
Returns the value of attribute pool_size.
4 5 6 |
# File 'lib/slave_pools/slave_pool.rb', line 4 def pool_size @pool_size end |
#slaves ⇒ Object
Returns the value of attribute slaves.
4 5 6 |
# File 'lib/slave_pools/slave_pool.rb', line 4 def slaves @slaves end |
Instance Method Details
#current ⇒ Object
13 14 15 |
# File 'lib/slave_pools/slave_pool.rb', line 13 def current @slaves[@current_index] end |
#next ⇒ Object
17 18 19 20 |
# File 'lib/slave_pools/slave_pool.rb', line 17 def next next_index! if @pool_size != 1 current end |