Class: Hx::Interop::StreamAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/interop/stream_adapter.rb

Overview

Base class for StreamReader and StreamWriter

Direct Known Subclasses

StreamReader, StreamWriter

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ StreamAdapter

Returns a new instance of StreamAdapter.

Parameters:

  • stream (IO, StringIO)


6
7
8
9
10
11
12
13
14
# File 'lib/interop/stream_adapter.rb', line 6

def initialize(stream)
  if stream.is_a? IO
    stream.sync = true
    stream.binmode
  end

  @stream = stream
  @mutex  = Mutex.new
end