Class: FiberRecycling::RecycledFiberPool

Inherits:
QuackPool
  • Object
show all
Defined in:
lib/fiber_recycling/recycled_fiber_pool.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecycledFiberPool

Returns a new instance of RecycledFiberPool.



11
12
13
# File 'lib/fiber_recycling/recycled_fiber_pool.rb', line 11

def initialize
  super(resource_class: RecycledFiber)
end

Class Method Details

.localObject



4
5
6
7
8
9
# File 'lib/fiber_recycling/recycled_fiber_pool.rb', line 4

def self.local
  unless Thread.current.thread_variable_get(:fiber_recycling__recycled_fiber_pool)
    Thread.current.thread_variable_set(:fiber_recycling__recycled_fiber_pool, new)
  end
  Thread.current.thread_variable_get(:fiber_recycling__recycled_fiber_pool)
end

Instance Method Details

#absorb_recycled_fiber(recycled_fiber) ⇒ Object



15
16
17
# File 'lib/fiber_recycling/recycled_fiber_pool.rb', line 15

def absorb_recycled_fiber(recycled_fiber)
  absorb_resource(recycled_fiber)
end

#borrowerObject



19
20
21
# File 'lib/fiber_recycling/recycled_fiber_pool.rb', line 19

def borrower
  RecycledFiberPoolBorrower.new(self)
end

#release_recycled_fiberObject



23
24
25
# File 'lib/fiber_recycling/recycled_fiber_pool.rb', line 23

def release_recycled_fiber
  release_resource
end