Class: Bitcoin::Grpc::ResponseEnum

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/grpc/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(req, response, wrapper_classs) ⇒ ResponseEnum

Returns a new instance of ResponseEnum.



215
216
217
218
219
220
# File 'lib/bitcoin/grpc/server.rb', line 215

def initialize(req, response, wrapper_classs)
  @req = req
  @response = response
  @wrapper_classs = wrapper_classs
  @logger = Bitcoin::Logger.create(:debug)
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



213
214
215
# File 'lib/bitcoin/grpc/server.rb', line 213

def logger
  @logger
end

#reqObject (readonly)

Returns the value of attribute req.



213
214
215
# File 'lib/bitcoin/grpc/server.rb', line 213

def req
  @req
end

#responseObject (readonly)

Returns the value of attribute response.



213
214
215
# File 'lib/bitcoin/grpc/server.rb', line 213

def response
  @response
end

#wrapper_classsObject (readonly)

Returns the value of attribute wrapper_classs.



213
214
215
# File 'lib/bitcoin/grpc/server.rb', line 213

def wrapper_classs
  @wrapper_classs
end

Instance Method Details

#eachObject



222
223
224
225
226
227
228
229
230
231
232
# File 'lib/bitcoin/grpc/server.rb', line 222

def each
  return enum_for(:each) unless block_given?
  loop do
    event = response.first
    if event
      yield wrapper_classs.build(event.request_id, event)
    else
      sleep(1)
    end
  end
end