class Knot::Protocol::RecordIO

Attributes

str[R]

Public Class Methods

new(sock, str = nil) click to toggle source
# File lib/knot/protocol.rb, line 125
def initialize sock, str = nil
        @str, @sock = str || '', sock
end

Public Instance Methods

read(n) click to toggle source
# File lib/knot/protocol.rb, line 137
def read n
        s = @sock.read n
        @str.insert -1, s
        s
end
unpack(pattern) click to toggle source
# File lib/knot/protocol.rb, line 129
def unpack pattern
        IOUnpack.new(pattern).unpack self
end
unpack1(pattern) click to toggle source
# File lib/knot/protocol.rb, line 133
def unpack1 pattern
        IOUnpack.new(pattern).unpack1 self
end