Sha256: 99cb0b66b54abc807f1246f37d1f546493dcdeaa32daecc237c1a9f05c36f379

Contents?: true

Size: 803 Bytes

Versions: 4

Compression:

Stored size: 803 Bytes

Contents

module Sanford; end
module Sanford::Protocol

  class FakeConnection

    attr_accessor :read_data, :peek_data, :write_data
    attr_accessor :closed, :closed_write
    attr_reader :read_timeout, :peek_timeout

    def initialize(read_data = nil)
      @read_data  = read_data || ""
      @peek_data  = read_data ? read_data[1] : ""
      @write_data = nil

      @read_timeout = nil
      @peek_timeout = nil

      @closed = false
      @closed_write = false
    end

    def read(timeout = nil)
      @read_timeout = timeout
      @read_data
    end

    def write(data)
      @write_data = data
    end

    def peek(timeout = nil)
      @peek_timeout = timeout
      @peek_data
    end

    def close
      @closed = true
    end

    def close_write
      @closed_write = true
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sanford-protocol-0.12.0 lib/sanford-protocol/fake_connection.rb
sanford-protocol-0.11.0 lib/sanford-protocol/fake_connection.rb
sanford-protocol-0.10.0 lib/sanford-protocol/fake_connection.rb
sanford-protocol-0.9.0 lib/sanford-protocol/fake_connection.rb