Module: QuSpec

Defined in:
lib/qu-spec.rb,
lib/qu-spec/version.rb,
lib/qu-spec/scheduler.rb

Defined Under Namespace

Modules: SchedulerExtension

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.enqueue_at(time, klass, *args) ⇒ Object



16
17
18
# File 'lib/qu-spec/scheduler.rb', line 16

def self.enqueue_at(time, klass, *args)
  Qu.backend.delayed_push(time, Qu::Payload.new(:klass => klass, :args => args))
end

.enqueue_in(time, klass, *args) ⇒ Object



20
21
22
# File 'lib/qu-spec/scheduler.rb', line 20

def self.enqueue_in(time, klass, *args)
  enqueue_at(Time.now + time, klass, *args)
end

.remove_delayed(klass, *args) ⇒ Object



24
25
26
# File 'lib/qu-spec/scheduler.rb', line 24

def self.remove_delayed(klass, *args)
  Qu.backend.remove_delayed(klass, *args)
end

.reset!Object



11
12
13
# File 'lib/qu-spec.rb', line 11

def self.reset!
  Qu.backend.clear
end

.schedule_for(klass) ⇒ Object



28
29
30
# File 'lib/qu-spec/scheduler.rb', line 28

def self.schedule_for(klass)
  Qu.backend.get_schedule_by_klass(klass)
end

.setup!Object



6
7
8
9
# File 'lib/qu-spec.rb', line 6

def self.setup!
  Qu.backend = Qu::Backend::Memory.new
  Qu.failure = nil
end