Class: Cql::Protocol::ResponseFrame

Inherits:
Object
  • Object
show all
Defined in:
lib/cql/protocol/response_frame.rb

Defined Under Namespace

Classes: FrameBody, FrameHeaders

Instance Method Summary collapse

Constructor Details

#initialize(buffer = ByteBuffer.new) ⇒ ResponseFrame

Returns a new instance of ResponseFrame.



6
7
8
9
# File 'lib/cql/protocol/response_frame.rb', line 6

def initialize(buffer=ByteBuffer.new)
  @headers = FrameHeaders.new(buffer)
  check_complete!
end

Instance Method Details

#<<(str) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/cql/protocol/response_frame.rb', line 31

def <<(str)
  if @body
    @body << str
  else
    @headers << str
    check_complete!
  end
end

#bodyObject



23
24
25
# File 'lib/cql/protocol/response_frame.rb', line 23

def body
  @body.response
end

#body_lengthObject



19
20
21
# File 'lib/cql/protocol/response_frame.rb', line 19

def body_length
  @headers && @headers.length
end

#complete?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/cql/protocol/response_frame.rb', line 27

def complete?
  @body && @body.complete?
end

#header_lengthObject



15
16
17
# File 'lib/cql/protocol/response_frame.rb', line 15

def header_length
  8
end

#stream_idObject



11
12
13
# File 'lib/cql/protocol/response_frame.rb', line 11

def stream_id
  @headers && @headers.stream_id
end