Module: Concussion::Persist

Defined in:
lib/concussion/persist.rb

Instance Method Summary collapse

Instance Method Details

#later(time, *args) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/concussion/persist.rb', line 11

def later(time, *args)
  time = Time.now if time < Time.now
  seconds = (time - Time.now).to_i
  @guid = SecureRandom.uuid
  Concussion.persist(self.class, @guid, time, *args)

  after(seconds) { perform(*args) }
end

#perform(*args) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/concussion/persist.rb', line 3

def perform(*args)
  begin
    super *args
  ensure
    Concussion.retire @guid
  end
end