Class: Eventish::SimpleEvent

Inherits:
Object
  • Object
show all
Extended by:
EventApi
Defined in:
lib/eventish/simple_event.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EventApi

<=>, after_event, before_event, event_name, priority, subscribe, subscribe_all

Class Method Details

.trigger(target, args, &block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/eventish/simple_event.rb', line 12

def trigger(target, args, &block)
  event = new
  before_event.each { |plugin| plugin.call(target, args, event: event, hook: :before, &block) }
  event.call(target, args, &block)
  after_event.each { |plugin| plugin.call(target, args, event: event, hook: :after, &block) }
  event
end

Instance Method Details

#call(_target, _args, &_block) ⇒ Object

Raises:

  • (NotImplementedError)


5
6
7
# File 'lib/eventish/simple_event.rb', line 5

def call(_target, _args, &_block)
  raise NotImplementedError
end