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
253 254 255 256 257 258 259 |
# File 'lib/yapper/db.rb', line 253 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
261 262 263 264 265 |
# File 'lib/yapper/db.rb', line 261 def self.trigger notifications = Thread.current[:yapper_notifications] Thread.current[:yapper_notifications] = nil notifications.each { |namespace, instances| notify(namespace, instances) } end |