Sha256: ecdfa1ae36577c3fb72f39a8872d86c9979299c5a8508a7b9f50af847a90b389

Contents?: true

Size: 966 Bytes

Versions: 17

Compression:

Stored size: 966 Bytes

Contents

module Resque
  module Failure
    # A Failure backend that uses multiple backends
    # delegates all queries to the first backend
    class Multiple < Base
      
      class << self
        attr_accessor :classes
      end
      
      def self.configure
        yield self
        Resque::Failure.backend = self
      end
      
      def initialize(*args)
        @backends = self.class.classes.map {|klass| klass.new(*args)}
      end
      def save
        @backends.each(&:save)
      end
      
      # The number of failures.
      def self.count
        classes.first.count
      end

      # Returns a paginated array of failure objects.
      def self.all(start = 0, count = 1)
        classes.first.all(start,count)
      end

      # A URL where someone can go to view failures.
      def self.url
        classes.first.url
      end
      
      # Clear all failure objects
      def self.clear
        classes.first.clear
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
resque-mongo-1.8.1 lib/resque/failure/multiple.rb
resque-1.8.0 lib/resque/failure/multiple.rb
resque-1.7.1 lib/resque/failure/multiple.rb
resque-1.7.0 lib/resque/failure/multiple.rb
resque-1.6.1 lib/resque/failure/multiple.rb
resque-1.6.0 lib/resque/failure/multiple.rb
resque-1.5.2 lib/resque/failure/multiple.rb
resque-1.5.1 lib/resque/failure/multiple.rb
scotttam-resque-0.0.5 lib/resque/failure/multiple.rb
scotttam-resque-0.0.4 lib/resque/failure/multiple.rb
scotttam-resque-0.0.3 lib/resque/failure/multiple.rb
scotttam-resque-0.0.2 lib/resque/failure/multiple.rb
scotttam-resque-0.0.1 lib/resque/failure/multiple.rb
grockit-resque-1.5.0 lib/resque/failure/multiple.rb
resque-1.5.0 lib/resque/failure/multiple.rb
resque-mongo-1.4.0 lib/resque/failure/multiple.rb
resque-1.4.0 lib/resque/failure/multiple.rb