Class: Peek::Views::Resque
- Inherits:
-
View
- Object
- View
- Peek::Views::Resque
- Defined in:
- lib/peek/views/resque.rb
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(options = {}) ⇒ Resque
constructor
A new instance of Resque.
- #job_count ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Resque
Returns a new instance of Resque.
6 7 8 |
# File 'lib/peek/views/resque.rb', line 6 def initialize( = {}) @queues = .fetch(:queues, ['*']) end |
Instance Method Details
#context ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/peek/views/resque.rb', line 15 def context { :jobs => { :failures => ::Resque::Failure.count } } end |
#job_count ⇒ Object
10 11 12 13 |
# File 'lib/peek/views/resque.rb', line 10 def job_count lookup = @queues == ['*'] ? ::Resque.queues : @queues lookup.collect { |queue| ::Resque.size(queue) }.inject(&:+) end |
#results ⇒ Object
23 24 25 |
# File 'lib/peek/views/resque.rb', line 23 def results { :jobs => job_count, :workers => ::Resque.workers.size } end |