Class: Bbq::Core::Session::Pool
- Inherits:
-
Object
- Object
- Bbq::Core::Session::Pool
- Defined in:
- lib/bbq/core/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.
30 31 32 33 |
# File 'lib/bbq/core/session.rb', line 30 def initialize @idle = [] @taken = [] end |
Instance Attribute Details
#idle ⇒ Object
Returns the value of attribute idle.
28 29 30 |
# File 'lib/bbq/core/session.rb', line 28 def idle @idle end |
#taken ⇒ Object
Returns the value of attribute taken.
28 29 30 |
# File 'lib/bbq/core/session.rb', line 28 def taken @taken end |
Instance Method Details
#next(driver) ⇒ Object
35 36 37 |
# File 'lib/bbq/core/session.rb', line 35 def next(driver) take_idle(driver) || create(driver) end |
#release ⇒ Object
39 40 41 42 43 |
# File 'lib/bbq/core/session.rb', line 39 def release taken.each(&:reset!) idle.concat(taken) taken.clear end |