Sha256: fd4ec876ee63011ed2400fe8c304e2b72f379a6c3b73b436ad2c5adfe8eb0f54
Contents?: true
Size: 582 Bytes
Versions: 90
Compression:
Stored size: 582 Bytes
Contents
module ActiveAdmin class EventDispatcher def initialize @events = {} end def clear_all_subscribers! @events = {} end def subscribe(*event_names, &block) event_names.each do |event| @events[event] ||= [] @events[event] << block end end def subscribers(event) @events[event] || [] end def dispatch(event, *args) subscribers(event).each do |subscriber| subscriber.call(*args) end end end # ActiveAdmin::Event is set to a dispatcher Event = EventDispatcher.new end
Version data entries
90 entries across 90 versions & 7 rubygems