class EnumeratorQueue
A EnumeratorQueue
wraps a Queue to yield the items added to it.
Public Class Methods
Source
# File src/ruby/bin/math_server.rb, line 78 def initialize(sentinel) @q = Queue.new @sentinel = sentinel end
Public Instance Methods
Source
# File src/ruby/bin/math_server.rb, line 83 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