class MovieMasher::FileQueueService

reads queue from local file system

Public Instance Methods

configure(config) click to toggle source
# File service/queue/file.rb, line 5
def configure(config)
  ok = !config[:queue_directory].to_s.empty?
  ok &&= File.directory?(config[:queue_directory])
  ok
end
receive_job() click to toggle source
# File service/queue/file.rb, line 10
def receive_job
  job_hash = nil
  files = Dir[Path.concat configuration[:queue_directory], '*']
  job_file = files.sort_by { |f| File.mtime(f) }.first
  if job_file
    job_hash = Hashable.resolved_hash(job_file)
    File.delete(job_file)
  end
  job_hash
end