Class: Resque::Plugins::RateLimited::UnPause

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/plugins/rate_limited/rate_limited_un_pause.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.queue=(value) ⇒ Object (writeonly)

Sets the attribute queue

Parameters:

  • value

    the value to set the attribute queue to.



8
9
10
# File 'lib/resque/plugins/rate_limited/rate_limited_un_pause.rb', line 8

def queue=(value)
  @queue = value
end

Class Method Details

.class_from_string(str) ⇒ Object



29
30
31
32
33
34
# File 'lib/resque/plugins/rate_limited/rate_limited_un_pause.rb', line 29

def class_from_string(str)
  return Object.const_get(str) unless str.include?('::')
  str.split('::').reduce(Object) do |mod, class_name|
    mod.const_get(class_name)
  end
end

.enqueue(timestamp, klass) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/resque/plugins/rate_limited/rate_limited_un_pause.rb', line 14

def enqueue(timestamp, klass)
  # If Resque scheduler is installed and queue is set - use it to queue a wake up job
  return unless use?
  Resque.enqueue_at_with_queue(
    @queue,
    timestamp,
    Resque::Plugins::RateLimited::UnPause,
    klass
  )
end

.perform(klass) ⇒ Object



25
26
27
# File 'lib/resque/plugins/rate_limited/rate_limited_un_pause.rb', line 25

def perform(klass)
  class_from_string(klass.to_s).un_pause
end

.use?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/resque/plugins/rate_limited/rate_limited_un_pause.rb', line 10

def use?
  Resque.respond_to?(:enqueue_at_with_queue) && @queue
end