Class: Ungulate::Server
- Inherits:
-
Object
- Object
- Ungulate::Server
- Defined in:
- lib/ungulate/server.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Server
Returns a new instance of Server.
5 6 7 8 9 |
# File 'lib/ungulate/server.rb', line 5 def initialize( = {}) @logger = [:logger] || ::Logger.new($stdout) @job_processor = [:job_processor] @queue = [:queue] end |
Class Method Details
.config ⇒ Object
12 13 14 |
# File 'lib/ungulate/server.rb', line 12 def config Ungulate.configuration end |
.run ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ungulate/server.rb', line 16 def run new( :job_processor => config.job_processor.call, :queue => config.queue.call ).run end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ungulate/server.rb', line 24 def run @logger.info "Checking for job on #{@queue.name}" = @queue.receive if success = @job_processor.process(.to_s) .delete success end end |