Class: SimpleTools::Events::Subscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_tools/events/subscriber.rb

Constant Summary collapse

BehaviourNotDefined =
Class.new(StandardError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_name, payload) ⇒ Subscriber

Returns a new instance of Subscriber.



14
15
16
17
# File 'lib/simple_tools/events/subscriber.rb', line 14

def initialize(event_name, payload)
  @event_name = event_name
  @payload = payload
end

Instance Attribute Details

#event_nameObject (readonly)

Returns the value of attribute event_name.



8
9
10
# File 'lib/simple_tools/events/subscriber.rb', line 8

def event_name
  @event_name
end

#payloadObject (readonly)

Returns the value of attribute payload.



8
9
10
# File 'lib/simple_tools/events/subscriber.rb', line 8

def payload
  @payload
end

Class Method Details

.notify(event_name, payload) ⇒ Object



10
11
12
# File 'lib/simple_tools/events/subscriber.rb', line 10

def self.notify(event_name, payload)
  new(event_name, payload).call
end

Instance Method Details

#callObject



19
20
21
# File 'lib/simple_tools/events/subscriber.rb', line 19

def call
  handle
end