Class: Turbo::Queue
- Inherits:
-
Object
- Object
- Turbo::Queue
- Defined in:
- lib/turbo/queue.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
-
#initialize(queue_name) ⇒ Queue
constructor
A new instance of Queue.
- #messages ⇒ Object
- #messages? ⇒ Boolean
- #send(message) ⇒ Object
Constructor Details
#initialize(queue_name) ⇒ Queue
Returns a new instance of Queue.
6 7 8 9 |
# File 'lib/turbo/queue.rb', line 6 def initialize(queue_name) self.name = queue_name self.queue = find_or_create(queue_name) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/turbo/queue.rb', line 4 def name @name end |
#queue ⇒ Object
Returns the value of attribute queue.
4 5 6 |
# File 'lib/turbo/queue.rb', line 4 def queue @queue end |
Instance Method Details
#messages ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/turbo/queue.rb', line 15 def = [] self.queue..each do || << Turbo::Message.new(:with => ) end end |
#messages? ⇒ Boolean
23 24 25 |
# File 'lib/turbo/queue.rb', line 23 def self.queue.size == 0 ? false : true end |
#send(message) ⇒ Object
11 12 13 |
# File 'lib/turbo/queue.rb', line 11 def send() self.queue.() end |