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