Class: FiberRecycling::RecycledFiberPoolBorrower
- Inherits:
-
Object
- Object
- FiberRecycling::RecycledFiberPoolBorrower
- Defined in:
- lib/fiber_recycling/recycled_fiber_pool_borrower.rb
Instance Method Summary collapse
-
#initialize(pool) ⇒ RecycledFiberPoolBorrower
constructor
A new instance of RecycledFiberPoolBorrower.
- #retrieve ⇒ Object
- #return ⇒ Object
- #returned? ⇒ Boolean
Constructor Details
#initialize(pool) ⇒ RecycledFiberPoolBorrower
Returns a new instance of RecycledFiberPoolBorrower.
4 5 6 7 |
# File 'lib/fiber_recycling/recycled_fiber_pool_borrower.rb', line 4 def initialize(pool) @pool = pool @recycled_fiber = nil end |
Instance Method Details
#retrieve ⇒ Object
9 10 11 12 |
# File 'lib/fiber_recycling/recycled_fiber_pool_borrower.rb', line 9 def retrieve @recycled_fiber ||= @pool.release_recycled_fiber @recycled_fiber end |
#return ⇒ Object
14 15 16 17 |
# File 'lib/fiber_recycling/recycled_fiber_pool_borrower.rb', line 14 def return @pool.absorb_recycled_fiber(@recycled_fiber) if @recycled_fiber nil end |
#returned? ⇒ Boolean
19 20 21 |
# File 'lib/fiber_recycling/recycled_fiber_pool_borrower.rb', line 19 def returned? @recycled_fiber end |