Class: Colloquy::Renderer::FlowPool

Inherits:
Object
  • Object
show all
Defined in:
lib/colloquy/flow_pool.rb

Class Method Summary collapse

Class Method Details

.add_flow(flow_name, flow) ⇒ Object



17
18
19
# File 'lib/colloquy/flow_pool.rb', line 17

def self.add_flow(flow_name, flow)
  @flow_pool[flow_name.to_sym] << flow
end

.create_flows(flow_name, flow_class, pool_size, options) ⇒ Object



3
4
5
6
7
# File 'lib/colloquy/flow_pool.rb', line 3

def self.create_flows(flow_name, flow_class, pool_size, options)
  pool_size.times do |i|
    flow_pool[flow_name.to_sym] << flow_class.constantize.new(flow_name, options)
  end
end

.flow_poolObject



9
10
11
# File 'lib/colloquy/flow_pool.rb', line 9

def self.flow_pool
  @flow_pool ||= Hash.new { |hash, key| hash[key] = [] } 
end

.pop_flow(flow_name) ⇒ Object



13
14
15
# File 'lib/colloquy/flow_pool.rb', line 13

def self.pop_flow(flow_name)
  @flow_pool[flow_name.to_sym].pop
end