Sha256: f282d7d6241807dc5eefe388de0675980be61404000d34a675a253963732a122

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

module Rpush
  module Daemon
    module ServiceConfigMethods
      DISPATCHERS = {
        :http => Rpush::Daemon::Dispatcher::Http,
        :tcp => Rpush::Daemon::Dispatcher::Tcp
      }

      def dispatcher(name = nil, options = {})
        @dispatcher_name = name
        @dispatcher_options = options
      end

      def dispatcher_class
        DISPATCHERS[@dispatcher_name] || (raise NotImplementedError)
      end

      def delivery_class
        const_get('Delivery')
      end

      def new_dispatcher(app)
        dispatcher_class.new(app, delivery_class, @dispatcher_options)
      end

      def loops(*loops)
        @loops ||= []
        @loops = loops if loops.any?
        @loops
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-1.0.0-java lib/rpush/daemon/service_config_methods.rb
rpush-1.0.0 lib/rpush/daemon/service_config_methods.rb