Class: BlockingEnumerator
- Inherits:
-
Object
- Object
- BlockingEnumerator
- Includes:
- Grpc::Testing, Grpc::Testing::PayloadType
- Defined in:
- src/ruby/pb/test/client.rb
Constant Summary
Constants included from Grpc::Testing
Grpc::Testing::BoolValue, Grpc::Testing::EchoStatus, Grpc::Testing::Empty, Grpc::Testing::EmptyMessage, Grpc::Testing::GaugeRequest, Grpc::Testing::GaugeResponse, Grpc::Testing::Payload, Grpc::Testing::PayloadType, Grpc::Testing::ReconnectInfo, Grpc::Testing::ReconnectParams, Grpc::Testing::ResponseParameters, Grpc::Testing::SimpleRequest, Grpc::Testing::SimpleResponse, Grpc::Testing::StreamingInputCallRequest, Grpc::Testing::StreamingInputCallResponse, Grpc::Testing::StreamingOutputCallRequest, Grpc::Testing::StreamingOutputCallResponse
Instance Method Summary collapse
- #each_item {|req| ... } ⇒ Object
-
#initialize(req_size, sleep_time) ⇒ BlockingEnumerator
constructor
A new instance of BlockingEnumerator.
Constructor Details
#initialize(req_size, sleep_time) ⇒ BlockingEnumerator
Returns a new instance of BlockingEnumerator.
218 219 220 221 |
# File 'src/ruby/pb/test/client.rb', line 218 def initialize(req_size, sleep_time) @req_size = req_size @sleep_time = sleep_time end |
Instance Method Details
#each_item {|req| ... } ⇒ Object
223 224 225 226 227 228 229 230 |
# File 'src/ruby/pb/test/client.rb', line 223 def each_item return enum_for(:each_item) unless block_given? req_cls = StreamingOutputCallRequest req = req_cls.new(payload: Payload.new(body: nulls(@req_size))) yield req # Sleep until after the deadline should have passed sleep(@sleep_time) end |