Class: Thrift::IOStreamTransport
- Defined in:
- lib/thrift/transport.rb
Overview
Very very simple implementation of wrapping two objects, one with a #read method and one with a #write method, into a transport for thrift.
Assumes both objects are open, remain open, don’t require flushing, etc.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(input, output) ⇒ IOStreamTransport
constructor
A new instance of IOStreamTransport.
- #open? ⇒ Boolean
- #read(sz) ⇒ Object
-
#to_io ⇒ Object
we’re assuming this is used in a IO.select for reading.
- #write(buf) ⇒ Object
Methods inherited from Transport
Constructor Details
#initialize(input, output) ⇒ IOStreamTransport
Returns a new instance of IOStreamTransport.
307 308 309 310 |
# File 'lib/thrift/transport.rb', line 307 def initialize(input, output) @input = input @output = output end |
Instance Method Details
#close ⇒ Object
315 |
# File 'lib/thrift/transport.rb', line 315 def close; @input.close; @output.close end |
#open? ⇒ Boolean
312 |
# File 'lib/thrift/transport.rb', line 312 def open?; not @input.closed? or not @output.closed? end |
#read(sz) ⇒ Object
313 |
# File 'lib/thrift/transport.rb', line 313 def read(sz); @input.read(sz) end |
#to_io ⇒ Object
we’re assuming this is used in a IO.select for reading
316 |
# File 'lib/thrift/transport.rb', line 316 def to_io; @input end |
#write(buf) ⇒ Object
314 |
# File 'lib/thrift/transport.rb', line 314 def write(buf); @output.write(buf) end |