36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/asir/transport/payload_io.rb', line 36
def _read_line_and_expect! stream, regexp, consume = nil
ok = false
until ok
line = stream.readline
_log { "_read_line_and_expect! #{stream} #{line.inspect}" }
ok = consume && consume.match(line) ? false : true
end
unless match = regexp.match(line)
_log { "_read_line_and_expect! #{stream} #{regexp.inspect} !~ #{line.inspect}" }
exc = UnexpectedResponse.new("expected #{regexp.inspect}, received #{line.inspect}")
exc.expected = regexp
exc.received = line
raise exc
end
match
end
|