Class: Wicoris::Postman::Postman

Inherits:
Object
  • Object
show all
Defined in:
lib/wicoris/postman/postman.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Postman

Returns a new instance of Postman.



4
5
6
7
# File 'lib/wicoris/postman/postman.rb', line 4

def initialize(opts = {})
  @opts = opts
  @logger = opts[:logger]
end

Instance Method Details

#runObject

Process each job.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wicoris/postman/postman.rb', line 10

def run
  jobs.each do |job|
    begin
      job.process
    rescue => e
      @logger.error(e) if @logger
    ensure
      job.clear!
    end
  end
end