Sha256: 4a24a54a2f91f98b98fab2bdee97759b1ab683c1e743ebf3d66ee7d75ca2bf46

Contents?: true

Size: 819 Bytes

Versions: 27

Compression:

Stored size: 819 Bytes

Contents

require_dependency "renalware"

module Renalware
  module Broadcasting
    include Wisper::Publisher
    extend ActiveSupport::Concern

    # Subscribes any listeners configured in Renalware.config.broadcast_subscription_map
    # to the current instance.
    #
    # Example usage
    #
    #   class SomeServiceObject
    #     include Broadcasting
    #
    #     def call
    #       ..
    #     end
    #   end
    #
    #   SomeServiceObject.new(..).broadcasting_to_configured_subscribers.call(..)
    #
    # See https://github.com/krisleech/wisper
    #
    def broadcasting_to_configured_subscribers
      subscribers = Renalware.config.broadcast_subscription_map[self.class.name]
      Array(subscribers).each{ |listener|
        subscribe(listener.to_s.constantize.new)
      }
      self
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.7 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.5 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.4 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.3 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.2 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.1 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc13 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc11 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc10 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc9 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc8 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc7 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc6 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc5 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc4 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc3 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.rc1 app/models/concerns/renalware/broadcasting.rb
renalware-core-2.0.0.pre.beta12 app/models/concerns/renalware/broadcasting.rb