Class: MuchRailsPubSub::Publisher

Inherits:
Object
  • Object
show all
Includes:
MuchRails::CallMethod
Defined in:
lib/much-rails-pub-sub/publisher.rb

Direct Known Subclasses

ActiveJobPublisher, TestPublisher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_name, event_params:) ⇒ Publisher

Returns a new instance of Publisher.



11
12
13
# File 'lib/much-rails-pub-sub/publisher.rb', line 11

def initialize(event_name, event_params:)
  @event = MuchRailsPubSub::Event.new(event_name, params: event_params)
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



9
10
11
# File 'lib/much-rails-pub-sub/publisher.rb', line 9

def event
  @event
end

Instance Method Details

#event_idObject



19
20
21
# File 'lib/much-rails-pub-sub/publisher.rb', line 19

def event_id
  event.id
end

#event_nameObject



23
24
25
# File 'lib/much-rails-pub-sub/publisher.rb', line 23

def event_name
  event.name
end

#event_paramsObject



27
28
29
# File 'lib/much-rails-pub-sub/publisher.rb', line 27

def event_params
  event.params
end

#on_callObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/much-rails-pub-sub/publisher.rb', line 15

def on_call
  raise NotImplementedError
end