Sha256: 6dd8676f4fa2c831966643ba91281712494c755300c1f725d494de6b28c79259

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

module Shoryuken
  module Polling
    QueueConfiguration = Struct.new(:name, :options) do
      def hash
        name.hash
      end

      def ==(other)
        case other
        when String
          if options.empty?
            name == other
          else
            false
          end
        else
          super
        end
      end

      alias_method :eql?, :==

      def to_s
        if options.empty?
          name
        else
          "#<QueueConfiguration #{name} options=#{options.inspect}>"
        end
      end
    end

    class BaseStrategy
      include Util

      def next_queue
        fail NotImplementedError
      end

      def messages_found(_queue, _messages_found)
        fail NotImplementedError
      end

      def message_processed(_queue); end

      def active_queues
        fail NotImplementedError
      end

      def ==(other)
        case other
        when Array
          @queues == other
        else
          if other.respond_to?(:active_queues)
            active_queues == other.active_queues
          else
            false
          end
        end
      end

      def delay
        @delay || Shoryuken.options[:delay].to_f
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shoryuken-6.2.1 lib/shoryuken/polling/base.rb
shoryuken-6.2.0 lib/shoryuken/polling/base.rb
shoryuken-6.1.1 lib/shoryuken/polling/base.rb
shoryuken-6.1.0 lib/shoryuken/polling/base.rb
shoryuken-6.0.0 lib/shoryuken/polling/base.rb
shoryuken-5.3.2 lib/shoryuken/polling/base.rb
shoryuken-5.3.1 lib/shoryuken/polling/base.rb
shoryuken-5.3.0 lib/shoryuken/polling/base.rb
shoryuken-5.2.3 lib/shoryuken/polling/base.rb
shoryuken-5.2.2 lib/shoryuken/polling/base.rb
shoryuken-5.2.1 lib/shoryuken/polling/base.rb
shoryuken-5.2.0 lib/shoryuken/polling/base.rb
shoryuken-5.1.1 lib/shoryuken/polling/base.rb
shoryuken-5.1.0 lib/shoryuken/polling/base.rb