Class: Bbq::Session::Pool
- Inherits:
-
Object
- Object
- Bbq::Session::Pool
- Defined in:
- lib/bbq/session.rb
Instance Attribute Summary collapse
-
#idle ⇒ Object
Returns the value of attribute idle.
-
#taken ⇒ Object
Returns the value of attribute taken.
Instance Method Summary collapse
-
#initialize ⇒ Pool
constructor
A new instance of Pool.
- #next(driver) ⇒ Object
- #release ⇒ Object
Constructor Details
#initialize ⇒ Pool
Returns a new instance of Pool.
27 28 29 30 |
# File 'lib/bbq/session.rb', line 27 def initialize @idle = [] @taken = [] end |
Instance Attribute Details
#idle ⇒ Object
Returns the value of attribute idle.
25 26 27 |
# File 'lib/bbq/session.rb', line 25 def idle @idle end |
#taken ⇒ Object
Returns the value of attribute taken.
25 26 27 |
# File 'lib/bbq/session.rb', line 25 def taken @taken end |
Instance Method Details
#next(driver) ⇒ Object
32 33 34 |
# File 'lib/bbq/session.rb', line 32 def next(driver) take_idle(driver) || create(driver) end |
#release ⇒ Object
36 37 38 39 40 |
# File 'lib/bbq/session.rb', line 36 def release taken.each(&:reset!) idle.concat(taken) taken.clear end |