Class: Yapper::DB::Notifications
- Inherits:
-
Object
- Object
- Yapper::DB::Notifications
- Defined in:
- lib/yapper/db.rb
Class Method Summary collapse
Class Method Details
.track(notifications) ⇒ Object
196 197 198 199 200 201 202 |
# File 'lib/yapper/db.rb', line 196 def self.track(notifications) Thread.current[:yapper_notifications] ||= {}.with_indifferent_access notifications.each do |namespace, instance| Thread.current[:yapper_notifications][namespace] ||= [] Thread.current[:yapper_notifications][namespace] << instance end end |
.trigger ⇒ Object
204 205 206 207 208 |
# File 'lib/yapper/db.rb', line 204 def self.trigger notifications = Thread.current[:yapper_notifications] Thread.current[:yapper_notifications] = nil notifications.each { |namespace, instances| notify(namespace, instances) } end |