Class: RudeQ::Worker
- Inherits:
-
Object
- Object
- RudeQ::Worker
- Defined in:
- lib/rude_q/worker.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#do! ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rude_q/worker.rb', line 33 def do! logger.info("starting up") if work = self.queue.get logger.info("found some work") do_work(work) else logger.info("couldn't find any work") end logger.info("finished for now") end |
#do_work(data) ⇒ Object
29 30 31 |
# File 'lib/rude_q/worker.rb', line 29 def do_work(data) raise NotImplementedError end |
#logger ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rude_q/worker.rb', line 44 def logger unless @logger @logger = Logger.new(RAILS_ROOT + "/log/#{self.class.to_s.underscore}_#{RAILS_ENV}.log") class << @logger def (severity, , progname, msg) "#{.strftime('%Y%m%d-%H:%M:%S')} (#{$$}) #{msg}\n" end end end return @logger end |
#queue ⇒ Object
62 63 64 |
# File 'lib/rude_q/worker.rb', line 62 def queue @queue ||= self.class.queue end |
#queue_name ⇒ Object
25 26 27 |
# File 'lib/rude_q/worker.rb', line 25 def queue_name raise NotImplementedError end |