Class: Cql::Protocol::ExecuteRequest
- Defined in:
- lib/cql/protocol/requests/execute_request.rb
Instance Attribute Summary collapse
-
#consistency ⇒ Object
readonly
Returns the value of attribute consistency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Attributes inherited from Request
Instance Method Summary collapse
- #eql?(rq) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(id, metadata, values, consistency) ⇒ ExecuteRequest
constructor
A new instance of ExecuteRequest.
- #to_s ⇒ Object
- #write(io) ⇒ Object
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(id, metadata, values, consistency) ⇒ ExecuteRequest
Returns a new instance of ExecuteRequest.
8 9 10 11 12 13 14 15 16 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 8 def initialize(id, , values, consistency) raise ArgumentError, "Metadata for #{.size} columns, but #{values.size} values given" if .size != values.size super(10) @id = id @metadata = @values = values @consistency = consistency @bytes = encode_body end |
Instance Attribute Details
#consistency ⇒ Object (readonly)
Returns the value of attribute consistency.
6 7 8 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 6 def consistency @consistency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 6 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 6 def @metadata end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 6 def values @values end |
Instance Method Details
#eql?(rq) ⇒ Boolean Also known as: ==
27 28 29 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 27 def eql?(rq) self.class === rq && rq.id == self.id && rq. == self. && rq.values == self.values && rq.consistency == self.consistency end |
#hash ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 32 def hash @h ||= begin h = 0 h = ((h & 33554431) * 31) ^ @id.hash h = ((h & 33554431) * 31) ^ @metadata.hash h = ((h & 33554431) * 31) ^ @values.hash h = ((h & 33554431) * 31) ^ @consistency.hash h end end |
#to_s ⇒ Object
22 23 24 25 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 22 def to_s id = @id.each_byte.map { |x| x.to_s(16) }.join('') %(EXECUTE #{id} #@values #{@consistency.to_s.upcase}) end |
#write(io) ⇒ Object
18 19 20 |
# File 'lib/cql/protocol/requests/execute_request.rb', line 18 def write(io) io << @bytes end |