Class: Thrift::Processor::UnaryProcessor

Inherits:
BaseProcessor show all
Defined in:
lib/thrift/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, info, middleware, handler) ⇒ UnaryProcessor

Returns a new instance of UnaryProcessor.



200
201
202
203
204
205
206
# File 'lib/thrift/processor.rb', line 200

def initialize(name, info, middleware, handler)
  @middleware = middleware
  @handler = handler
  @arg_keys = info[:args]

  super name, info[:args_klass]
end

Instance Method Details

#process(_seqid, iprot, _oprot) ⇒ Object



208
209
210
211
212
213
214
215
# File 'lib/thrift/processor.rb', line 208

def process(_seqid, iprot, _oprot)
  @middleware.handle_unary(@name, read_args(iprot)) do |args|
    @handler.send(@name, *@arg_keys.map { |k| args.send k })
    nil
  end

  true
end