Sha256: fc583b79be9204785e82870effd9358bea9e722ee54c6a416643341939cc2615

Contents?: true

Size: 400 Bytes

Versions: 20

Compression:

Stored size: 400 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
  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

20 entries across 20 versions & 1 rubygems

Version Path
iostreams-1.10.3 test/minimal_file_reader.rb
iostreams-1.10.2 test/minimal_file_reader.rb
iostreams-1.10.1 test/minimal_file_reader.rb
iostreams-1.10.0 test/minimal_file_reader.rb
iostreams-1.9.0 test/minimal_file_reader.rb
iostreams-1.8.0 test/minimal_file_reader.rb
iostreams-1.7.0 test/minimal_file_reader.rb
iostreams-1.6.2 test/minimal_file_reader.rb
iostreams-1.6.1 test/minimal_file_reader.rb
iostreams-1.6.0 test/minimal_file_reader.rb
iostreams-1.5.1 test/minimal_file_reader.rb
iostreams-1.5.0 test/minimal_file_reader.rb
iostreams-1.4.0 test/minimal_file_reader.rb
iostreams-1.3.3 test/minimal_file_reader.rb
iostreams-1.3.2 test/minimal_file_reader.rb
iostreams-1.3.1 test/minimal_file_reader.rb
iostreams-1.3.0 test/minimal_file_reader.rb
iostreams-1.2.1 test/minimal_file_reader.rb
iostreams-1.2.0 test/minimal_file_reader.rb
iostreams-1.1.1 test/minimal_file_reader.rb