Class: FuQueue
- Inherits:
-
Object
- Object
- FuQueue
- Defined in:
- lib/fu_queue.rb
Overview
FuQueue
Class Method Summary collapse
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(queue_name) ⇒ FuQueue
constructor
A new instance of FuQueue.
- #put(message) ⇒ Object
Constructor Details
#initialize(queue_name) ⇒ FuQueue
Returns a new instance of FuQueue.
9 10 11 |
# File 'lib/fu_queue.rb', line 9 def initialize(queue_name) @sm_queue = SMQueue.new(YAML.load_file("#{RAILS_ROOT}/config/fu_queue.yml")[RAILS_ENV][queue_name.to_s]) end |
Class Method Details
.[](queue_name) ⇒ Object
4 5 6 |
# File 'lib/fu_queue.rb', line 4 def [](queue_name) ( @queues ||= {} )[queue_name] ||= new(queue_name) end |
Instance Method Details
#get ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/fu_queue.rb', line 13 def get if block_given? @sm_queue.get do || yield YAML.parse(.body).transform end else YAML.parse(@sm_queue.get.body).transform end end |
#put(message) ⇒ Object
23 24 25 |
# File 'lib/fu_queue.rb', line 23 def put() @sm_queue.put(.to_yaml) end |