Class: Cql::Protocol::PrepareRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/cql/protocol/requests/prepare_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#opcode

Instance Method Summary collapse

Methods inherited from Request

change_stream_id, #encode_frame

Methods included from Encoding

#write_bytes, #write_consistency, #write_decimal, #write_double, #write_float, #write_int, #write_long, #write_long_string, #write_short, #write_short_bytes, #write_string, #write_string_list, #write_string_map, #write_uuid, #write_varint

Constructor Details

#initialize(cql) ⇒ PrepareRequest

Returns a new instance of PrepareRequest.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/cql/protocol/requests/prepare_request.rb', line 8

def initialize(cql)
  raise ArgumentError, 'No CQL given!' unless cql
  super(9)
  @cql = cql
end

Instance Attribute Details

#cqlObject (readonly)

Returns the value of attribute cql.



6
7
8
# File 'lib/cql/protocol/requests/prepare_request.rb', line 6

def cql
  @cql
end

Instance Method Details

#eql?(rq) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


22
23
24
# File 'lib/cql/protocol/requests/prepare_request.rb', line 22

def eql?(rq)
  self.class === rq && rq.cql == self.cql
end

#hashObject



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

def hash
  @h ||= @cql.hash
end

#to_sObject



18
19
20
# File 'lib/cql/protocol/requests/prepare_request.rb', line 18

def to_s
  %(PREPARE "#@cql")
end

#write(io) ⇒ Object



14
15
16
# File 'lib/cql/protocol/requests/prepare_request.rb', line 14

def write(io)
  write_long_string(io, @cql)
end