Class: ActiveRepository::Callback::Pool

Inherits:
Object
  • Object
show all
Defined in:
lib/active_repository/callback/pool.rb

Instance Method Summary collapse

Constructor Details

#initializePool

Returns a new instance of Pool.



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

def initialize
  @pools = {}
end

Instance Method Details

#add(pool, callback) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/active_repository/callback/pool.rb', line 8

def add(pool, callback)
  return false unless can_add?(pool, callback)

  @pools[pool] ||= []

  @pools[pool] << callback

  true
end

#get(pool = '') ⇒ Object



18
19
20
# File 'lib/active_repository/callback/pool.rb', line 18

def get(pool='')
  @pools[pool] || []
end