Sha256: d418339b2d5f3ba2149b51963b902b2d56cca2173a431a843df3e83f79f29503

Contents?: true

Size: 405 Bytes

Versions: 11

Compression:

Stored size: 405 Bytes

Contents

# The miminum methods that any IOStreams Reader must implement.
class MinimalFileReader
  def self.open(file_name)
    io = new(file_name)
    yield(io)
  ensure
    io.close if io
  end

  def initialize(file_name)
    @file = File.open(file_name)
  end

  def read(size = nil, outbuf = nil)
    @file.read(size, outbuf)
  end

  def close
    @file.close
  end

  def closed?
    @file.closed
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
iostreams-1.1.0 test/minimal_file_reader.rb
iostreams-1.0.0 test/minimal_file_reader.rb
iostreams-1.0.0.beta7 test/minimal_file_reader.rb
iostreams-1.0.0.beta6 test/minimal_file_reader.rb
iostreams-1.0.0.beta5 test/minimal_file_reader.rb
iostreams-1.0.0.beta4 test/minimal_file_reader.rb
iostreams-1.0.0.beta3 test/minimal_file_reader.rb
iostreams-1.0.0.beta2 test/minimal_file_reader.rb
iostreams-1.0.0.beta test/minimal_file_reader.rb
iostreams-0.20.3 test/minimal_file_reader.rb
iostreams-0.20.2 test/minimal_file_reader.rb