Class: Sunsap::Reader
- Inherits:
-
Object
- Object
- Sunsap::Reader
- Defined in:
- lib/sunsap.rb
Instance Method Summary collapse
-
#initialize(reporter) ⇒ Reader
constructor
Make a reader.
-
#read ⇒ Object
Read the queue the right way.
-
#read! ⇒ Object
Read the queue if it’s not empty.
-
#read_friendly ⇒ Object
Read the queue in a more friendly matter.
-
#read_friendly! ⇒ Object
Read the queue if it’s not empty.
Constructor Details
#initialize(reporter) ⇒ Reader
Make a reader
62 63 64 65 |
# File 'lib/sunsap.rb', line 62 def initialize(reporter) @reporter = reporter true end |
Instance Method Details
#read ⇒ Object
Read the queue the right way
75 76 77 |
# File 'lib/sunsap.rb', line 75 def read {:messages => queuesize, :queue => queue} end |
#read! ⇒ Object
Read the queue if it’s not empty
90 91 92 93 94 95 96 97 |
# File 'lib/sunsap.rb', line 90 def read! unless queuesize >= 1 raise "Queue was empty" else queue end {:messages => queuesize, :queue => queue} end |
#read_friendly ⇒ Object
Read the queue in a more friendly matter
110 111 112 |
# File 'lib/sunsap.rb', line 110 def read_friendly "Messages: #{queuesize}, Queue: #{queue}" end |
#read_friendly! ⇒ Object
Read the queue if it’s not empty
125 126 127 128 129 130 131 132 |
# File 'lib/sunsap.rb', line 125 def read_friendly! unless queuesize >= 1 raise "Queue was empty" else queue "Messages: #{queuesize}, Queue: #{queue}" end end |