Module: Thrift::Processor
- Defined in:
- lib/thrift/processor.rb
Instance Method Summary collapse
- #initialize(handler) ⇒ Object
- #process(iprot, oprot) ⇒ Object
- #read_args(iprot, args_class) ⇒ Object
- #write_result(result, oprot, name, seqid) ⇒ Object
Instance Method Details
#initialize(handler) ⇒ Object
22 23 24 |
# File 'lib/thrift/processor.rb', line 22 def initialize(handler) @handler = handler end |
#process(iprot, oprot) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/thrift/processor.rb', line 26 def process(iprot, oprot) name, type, seqid = iprot. if respond_to?("process_#{name}") send("process_#{name}", seqid, iprot, oprot) true else iprot.skip(Types::STRUCT) iprot. x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name) oprot.(name, MessageTypes::EXCEPTION, seqid) x.write(oprot) oprot. oprot.trans.flush false end end |
#read_args(iprot, args_class) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/thrift/processor.rb', line 43 def read_args(iprot, args_class) args = args_class.new args.read(iprot) iprot. args end |
#write_result(result, oprot, name, seqid) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/thrift/processor.rb', line 50 def write_result(result, oprot, name, seqid) if @service oprot.(@service + ':' + name, MessageTypes::REPLY, seqid) else oprot.(name, MessageTypes::REPLY, seqid) end result.write(oprot) oprot. oprot.trans.flush end |