module Afterparty

Constants

VERSION

Public Class Methods

job_valid?(job) click to toggle source

returns true if job has an :execute_at value

# File lib/afterparty.rb, line 15
def self.job_valid? job
  job.respond_to?(:execute_at) && !job.execute_at.nil?
end
load(raw) click to toggle source
# File lib/afterparty.rb, line 19
def self.load(raw)
  begin
    begin
      return YAML.load(raw)
    rescue ArgumentError => e
      # lots of yaml load errors are because something that hasn't been
      # required. recursively require on these errors
      # Invoke the autoloader and try again if object's class is undefined
      if e.message =~ /undefined class\/module (.*)$/
        $1.constantize rescue return nil
      end
      return load(raw)
    end
  rescue Exception => e
    return nil
  end
end
queue_time(job) click to toggle source

return timestamp of :execute_at or current time

# File lib/afterparty.rb, line 10
def self.queue_time job
  time = job_valid?(job) ? job.execute_at : DateTime.now
end