Class: ActiveAdmin::EventDispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/event.rb

Instance Method Summary collapse

Instance Method Details

#dispatch(event, *args) ⇒ Object



12
13
14
15
# File 'lib/active_admin/event.rb', line 12

def dispatch(event, *args)
  Deprecation.warn "`ActiveAdmin::Event.dispatch` is deprecated, use `ActiveSupport::Notifications.publish`"
  ActiveSupport::Notifications.publish event, *args
end

#subscribe(*event_names, &block) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/active_admin/event.rb', line 4

def subscribe(*event_names, &block)
  Deprecation.warn "`ActiveAdmin::Event.subscribe` is deprecated, use `ActiveSupport::Notifications.subscribe`"
  event_names.each do |event|
    ActiveSupport::Notifications.subscribe event,
      &wrap_block_for_active_support_notifications(block)
  end
end

#wrap_block_for_active_support_notifications(block) ⇒ Object



17
18
19
# File 'lib/active_admin/event.rb', line 17

def wrap_block_for_active_support_notifications block
  proc { |event, *args| block.call *args }
end