Class: Cql::Protocol::SchemaChangeEventResponse

Inherits:
EventResponse show all
Defined in:
lib/cql/protocol/responses/schema_change_event_result_response.rb

Constant Summary collapse

TYPE =
'SCHEMA_CHANGE'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResultResponse

#void?

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(*args) ⇒ SchemaChangeEventResponse

Returns a new instance of SchemaChangeEventResponse.



10
11
12
13
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 10

def initialize(*args)
  @change, @keyspace, @table = args
  @type = TYPE
end

Instance Attribute Details

#changeObject (readonly)

Returns the value of attribute change.



8
9
10
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 8

def change
  @change
end

#keyspaceObject (readonly)

Returns the value of attribute keyspace.



8
9
10
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 8

def keyspace
  @keyspace
end

#tableObject (readonly)

Returns the value of attribute table.



8
9
10
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 8

def table
  @table
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 8

def type
  @type
end

Class Method Details

.decode!(buffer) ⇒ Object



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

def self.decode!(buffer)
  new(read_string!(buffer), read_string!(buffer), read_string!(buffer))
end

Instance Method Details

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

Returns:

  • (Boolean)


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

def eql?(rs)
  rs.type == self.type && rs.change == self.change && rs.keyspace == self.keyspace && rs.table == self.table
end

#hashObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 24

def hash
  @h ||= begin
    h = 0
    h = ((h & 33554431) * 31) ^ @type.hash
    h = ((h & 33554431) * 31) ^ @change.hash
    h = ((h & 33554431) * 31) ^ @keyspace.hash
    h = ((h & 33554431) * 31) ^ @table.hash
    h
  end
end

#to_sObject



35
36
37
# File 'lib/cql/protocol/responses/schema_change_event_result_response.rb', line 35

def to_s
  %(EVENT #@type #@change "#@keyspace" "#@table")
end