Sha256: bc9abe24de264b3c7cf3b1d832904a68205ec5d190a41e179b631ea7dc7ca414

Contents?: true

Size: 408 Bytes

Versions: 3

Compression:

Stored size: 408 Bytes

Contents

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

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
concussion-0.0.3 lib/concussion/persist.rb
concussion-0.0.2 lib/concussion/persist.rb
concussion-0.0.1 lib/concussion/persist.rb