Class: Cql::Protocol::PreparedResultResponse
- Inherits:
-
ResultResponse
- Object
- Response
- ResultResponse
- Cql::Protocol::PreparedResultResponse
- Defined in:
- lib/cql/protocol/responses/prepared_result_response.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Attributes inherited from ResultResponse
Class Method Summary collapse
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(id, metadata, trace_id) ⇒ PreparedResultResponse
constructor
A new instance of PreparedResultResponse.
- #to_s ⇒ Object
Methods inherited from ResultResponse
Methods included from Decoding
#read_byte!, #read_bytes!, #read_consistency!, #read_decimal!, #read_double!, #read_float!, #read_inet!, #read_int!, #read_long!, #read_long_string!, #read_option!, #read_short!, #read_short_bytes!, #read_string!, #read_string_list!, #read_string_map!, #read_string_multimap!, #read_uuid!, #read_varint!
Constructor Details
#initialize(id, metadata, trace_id) ⇒ PreparedResultResponse
Returns a new instance of PreparedResultResponse.
8 9 10 11 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 8 def initialize(id, , trace_id) super(trace_id) @id, @metadata = id, end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 6 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 6 def @metadata end |
Class Method Details
.decode!(buffer, trace_id = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 13 def self.decode!(buffer, trace_id=nil) id = read_short_bytes!(buffer) = RowsResultResponse.(buffer) new(id, , trace_id) end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
19 20 21 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 19 def eql?(other) self.id == other.id && self. == other. && self.trace_id == other.trace_id end |
#hash ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 24 def hash @h ||= begin h = 0 h = ((h & 0x01ffffff) * 31) ^ @id.hash h = ((h & 0x01ffffff) * 31) ^ @metadata.hash h = ((h & 0x01ffffff) * 31) ^ @trace_id.hash h end end |
#to_s ⇒ Object
34 35 36 37 |
# File 'lib/cql/protocol/responses/prepared_result_response.rb', line 34 def to_s hex_id = @id.each_byte.map { |x| x.to_s(16).rjust(2, '0') }.join('') %(RESULT PREPARED #{hex_id} #@metadata) end |