Class: Resque::Failure::Multiple
- Defined in:
- lib/resque/failure/multiple.rb
Overview
A Failure backend that uses multiple backends delegates all queries to the first backend
Class Attribute Summary collapse
-
.classes ⇒ Object
Returns the value of attribute classes.
Attributes inherited from Base
#exception, #payload, #queue, #worker
Class Method Summary collapse
-
.all(start = 0, count = 1) ⇒ Object
Returns a paginated array of failure objects.
-
.clear ⇒ Object
Clear all failure objects.
- .configure {|_self| ... } ⇒ Object
-
.count ⇒ Object
The number of failures.
- .remove(index) ⇒ Object
- .requeue(*args) ⇒ Object
-
.search_count ⇒ Object
Number of result of a failures search.
-
.search_results(query, start = 0, count = 1) ⇒ Object
The results of a failures search.
-
.url ⇒ Object
A URL where someone can go to view failures.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Multiple
constructor
A new instance of Multiple.
- #save ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ Multiple
Returns a new instance of Multiple.
16 17 18 19 |
# File 'lib/resque/failure/multiple.rb', line 16 def initialize(*args) super @backends = self.class.classes.map {|klass| klass.new(*args)} end |
Class Attribute Details
.classes ⇒ Object
Returns the value of attribute classes.
8 9 10 |
# File 'lib/resque/failure/multiple.rb', line 8 def classes @classes end |
Class Method Details
.all(start = 0, count = 1) ⇒ Object
Returns a paginated array of failure objects.
36 37 38 |
# File 'lib/resque/failure/multiple.rb', line 36 def self.all(start = 0, count = 1) classes.first.all(start,count) end |
.clear ⇒ Object
Clear all failure objects
51 52 53 |
# File 'lib/resque/failure/multiple.rb', line 51 def self.clear classes.first.clear end |
.configure {|_self| ... } ⇒ Object
11 12 13 14 |
# File 'lib/resque/failure/multiple.rb', line 11 def self.configure yield self Resque::Failure.backend = self end |
.count ⇒ Object
The number of failures.
26 27 28 |
# File 'lib/resque/failure/multiple.rb', line 26 def self.count classes.first.count end |
.remove(index) ⇒ Object
59 60 61 |
# File 'lib/resque/failure/multiple.rb', line 59 def self.remove(index) classes.each { |klass| klass.remove(index) } end |
.requeue(*args) ⇒ Object
55 56 57 |
# File 'lib/resque/failure/multiple.rb', line 55 def self.requeue(*args) classes.first.requeue(*args) end |
.search_count ⇒ Object
Number of result of a failures search.
31 32 33 |
# File 'lib/resque/failure/multiple.rb', line 31 def self.search_count classes.first.search_count if classes.first.respond_to?(:search_count) end |
.search_results(query, start = 0, count = 1) ⇒ Object
The results of a failures search.
41 42 43 |
# File 'lib/resque/failure/multiple.rb', line 41 def self.search_results(query, start = 0, count = 1) classes.first.search_results(query, start, count) if classes.first.respond_to?(:search_results) end |
.url ⇒ Object
A URL where someone can go to view failures.
46 47 48 |
# File 'lib/resque/failure/multiple.rb', line 46 def self.url classes.first.url end |
Instance Method Details
#save ⇒ Object
21 22 23 |
# File 'lib/resque/failure/multiple.rb', line 21 def save @backends.each(&:save) end |