Module: Restalk::BeanstalkAdapter
- Defined in:
- lib/restalk.rb
Instance Method Summary collapse
Instance Method Details
#init(server = nil, queue = nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/restalk.rb', line 26 def init(server = nil, queue = nil) require 'beaneater' @beanstalk = Beaneater::Pool.new([server || ENV['BEANSTALK'] || '127.0.0.1:11300']) tube = queue || ENV['BEANSTALK_QUEUE'] || 'default' @beanstalk = @beanstalk.tubes[tube] end |
#pop ⇒ Object
37 38 39 |
# File 'lib/restalk.rb', line 37 def pop @beanstalk.reserve if @beanstalk.peek(:ready) end |
#push(data) ⇒ Object
33 34 35 |
# File 'lib/restalk.rb', line 33 def push(data) @beanstalk.put(data) end |
#stats ⇒ Object
41 42 43 |
# File 'lib/restalk.rb', line 41 def stats @beanstalk.stats end |