Class: RemoteRuby::CompatIOReader
- Inherits:
-
Object
- Object
- RemoteRuby::CompatIOReader
- Defined in:
- lib/remote_ruby/compat_io_reader.rb
Overview
Wraps any object that responds to #readpartial with a readable IO object
Instance Attribute Summary collapse
-
#readable ⇒ Object
readonly
Returns the value of attribute readable.
Instance Method Summary collapse
-
#initialize(io) ⇒ CompatIOReader
constructor
A new instance of CompatIOReader.
- #join ⇒ Object
Constructor Details
#initialize(io) ⇒ CompatIOReader
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/remote_ruby/compat_io_reader.rb', line 8 def initialize(io) if io.is_a?(IO) @readable = io return end raise 'Object must respond to #readpartial' unless io.respond_to?(:readpartial) @readable, @writeable = IO.pipe @thread = start(io) end |
Instance Attribute Details
#readable ⇒ Object (readonly)
Returns the value of attribute readable.
6 7 8 |
# File 'lib/remote_ruby/compat_io_reader.rb', line 6 def readable @readable end |
Instance Method Details
#join ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/remote_ruby/compat_io_reader.rb', line 20 def join return unless @writeable @writeable.close @thread.join @readable.close end |