class QPush::Server::JobLoader

The Loader will 'require' all jobs within the users job folder. The job folder is specified in the config.

Public Class Methods

call() click to toggle source

Provides a shortend caller.

# File lib/qpush/server/loader.rb, line 9
def self.call
  loader = new
  loader.call
end

Public Instance Methods

call() click to toggle source

Entrypoint to load all jobs.

# File lib/qpush/server/loader.rb, line 16
def call
  flush_jobs
  load_jobs
end

Private Instance Methods

flush_jobs() click to toggle source

Removes old jobs from the redis job list.

# File lib/qpush/server/loader.rb, line 25
def flush_jobs
  Server.redis { |c| c.del(QPush::Base::KEY + ':jobs') }
end
load_jobs() click to toggle source

Requires user jobs that are specified from the config.

# File lib/qpush/server/loader.rb, line 31
def load_jobs
  Dir[Dir.pwd + "#{Server.config.jobs_path}/**/*.rb"].each do |file|
    require file
  end
end