Module: Cramp::FiberPool::ClassMethods

Defined in:
lib/cramp/fiber_pool.rb

Instance Method Summary collapse

Instance Method Details

#use_fiber_pool(options = {}) {|self.fiber_pool| ... } ⇒ Object

Yields:

  • (self.fiber_pool)


10
11
12
13
14
15
16
17
18
# File 'lib/cramp/fiber_pool.rb', line 10

def use_fiber_pool(options = {})
  unless defined?(::FiberPool)
    raise "Fiber support is only available for Rubies >= 1.9.2"
  end

  self.fiber_pool = ::FiberPool.new(options[:size] || 100)
  yield self.fiber_pool if block_given?
  include UsesFiberPool
end