Sha256: 2240d7eca0f0fb377dbd3a685702aa868579e14fd0e112b20b1934dbfe869700

Contents?: true

Size: 554 Bytes

Versions: 3

Compression:

Stored size: 554 Bytes

Contents

module Alondra

  class PushingException < StandardError; end

  module Pushing
    def push(*args)
      raise PushingException.new('You need to specify the channel to push') unless args.last[:to].present?

      to = args.last.delete(:to)
      
      # If we are called in the context of a request we save this information
      # so we can create proper routes
      caller_request = self.respond_to?(:request) ? request : nil
      
      controller = PushController.new(self, to, caller_request)
      controller.render_push(args)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alondra-0.1.1 lib/alondra/pushing.rb
alondra-0.1.0 lib/alondra/pushing.rb
alondra-0.0.4 lib/alondra/pushing.rb