Sha256: f9ec9e877ebcafd2a2a32ae111342b0ebeb9baf444c5f2b812350b75e20cc702

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 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 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

8 entries across 8 versions & 1 rubygems

Version Path
shoryuken-5.0.6 lib/shoryuken/polling/base.rb
shoryuken-5.0.5 lib/shoryuken/polling/base.rb
shoryuken-5.0.4 lib/shoryuken/polling/base.rb
shoryuken-5.0.3 lib/shoryuken/polling/base.rb
shoryuken-5.0.2 lib/shoryuken/polling/base.rb
shoryuken-5.0.1 lib/shoryuken/polling/base.rb
shoryuken-5.0.0 lib/shoryuken/polling/base.rb
shoryuken-4.0.3 lib/shoryuken/polling/base.rb