class Gapic::StreamInput


Manages requests for an input stream and holds the stream open until {#close} is called.
#

def close

Returns:
  • (StreamInput) - Returns self.
def close
  @queue.push self
  self
end

def initialize *requests

Parameters:
  • requests (Object) --
def initialize *requests
  @queue = Queue.new
  # Push initial requests into the queue
  requests.each { |request| @queue.push request }
end

def push request

Returns:
  • (StreamInput) - Returns self.

Parameters:
  • request (Object) --
def push request
  @queue.push request
  self
end

def to_enum

Returns:
  • (Enumerator) - An Enumerator is returned if no block is given.

Other tags:
    Yieldparam: request - The request object.

Other tags:
    Yield: - The block for accessing each request.

Other tags:
    Private: -
def to_enum
  return enum_for :to_enum unless block_given?
  loop do
    request = @queue.pop
    break if request.equal? self
    yield request
  end
end