Sha256: 315fd4435a749b7744bbe198586b4e6e7e254010072c4190d1ede9bd2af9df2f

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

require 'fake_io'

class TestIO
  
  include FakeIO

  def initialize(chunks)
    @index  = 0
    @blocks = chunks

    super()
  end

  protected

  def io_open
    3
  end

  def io_read
    unless (block = @blocks[@index])
      raise(EOFError,"end of stream")
    end

    @index += 1
    return block
  end

  def io_write(data)
    @blocks[@index] = data
    @index += 1

    return data.length
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_io-0.1.0 spec/classes/test_io.rb