class Announcer::Publishers::Publisher

Public Class Methods

new(instance=nil, params={}) click to toggle source
# File lib/announcer/publishers/publisher.rb, line 8
def initialize(instance=nil, params={})
  @instance = instance
  @_params = params
end

Public Instance Methods

config() click to toggle source
Calls superclass method Announcer::Mixins::HasConfig#config
# File lib/announcer/publishers/publisher.rb, line 13
def config
  @__config ||= super.merge_hash!(@_params)
end
publish(event) click to toggle source

publish(event)

This method should be overridden by a subclass. Make sure to call “super” so that proper sanity checks can be performed.

# File lib/announcer/publishers/publisher.rb, line 23
def publish(event)
  unless event.instance == instance
    raise Errors::PublisherError, "Event for different instance"
  end
end