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