Module: PoolParty::Pool

Included in:
Object
Defined in:
lib/poolparty/pool/pool.rb

Defined Under Namespace

Classes: Pool

Instance Method Summary collapse

Instance Method Details

#pool(name = :main, &block) ⇒ Object



4
5
6
# File 'lib/poolparty/pool/pool.rb', line 4

def pool(name=:main, &block)
  pools.has_key?(name) ? pools[name] : (pools[name] = Pool.new(name, &block))
end

#pools ⇒ Object



8
9
10
# File 'lib/poolparty/pool/pool.rb', line 8

def pools
  $pools ||= {}
end

#remove_pool(name) ⇒ Object

Helpers



51
52
53
# File 'lib/poolparty/pool/pool.rb', line 51

def remove_pool(name)
  pools.delete(name) if pools.has_key?(name)
end

#reset! ⇒ Object



17
18
19
# File 'lib/poolparty/pool/pool.rb', line 17

def reset!
  $pools = $clouds = $plugins = nil
end

#with_pool(pool, opts = {}, &block) ⇒ Object



12
13
14
15
# File 'lib/poolparty/pool/pool.rb', line 12

def with_pool(pool, opts={}, &block)
  pool.options.merge!(opts)
  pool.instance_eval &block if block
end