Class: ActiveRepository::Callback::Pool
- Inherits:
-
Object
- Object
- ActiveRepository::Callback::Pool
- Defined in:
- lib/active_repository/callback/pool.rb
Instance Method Summary collapse
- #add(pool, callback) ⇒ Object
- #get(pool = '') ⇒ Object
-
#initialize ⇒ Pool
constructor
A new instance of Pool.
Constructor Details
#initialize ⇒ Pool
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 |