Class: Google::Cloud::Speech::Stream::EnumeratorQueue
- Inherits:
-
Object
- Object
- Google::Cloud::Speech::Stream::EnumeratorQueue
- Extended by:
- Forwardable
- Defined in:
- lib/google/cloud/speech/stream.rb
Instance Method Summary collapse
- #each_item ⇒ Object
-
#initialize(sentinel) ⇒ EnumeratorQueue
constructor
A new instance of EnumeratorQueue.
Constructor Details
#initialize(sentinel) ⇒ EnumeratorQueue
Returns a new instance of EnumeratorQueue.
544 545 546 547 |
# File 'lib/google/cloud/speech/stream.rb', line 544 def initialize sentinel @q = Queue.new @sentinel = sentinel end |
Instance Method Details
#each_item ⇒ Object
550 551 552 553 554 555 556 557 558 |
# File 'lib/google/cloud/speech/stream.rb', line 550 def each_item return enum_for(:each_item) unless block_given? loop do r = @q.pop break if r.equal? @sentinel fail r if r.is_a? Exception yield r end end |