Class: Cql::Client::ColumnMetadata
- Inherits:
-
Object
- Object
- Cql::Client::ColumnMetadata
- Defined in:
- lib/cql/client/column_metadata.rb
Overview
Represents metadata about a column in a query result set or prepared statement. Apart from the keyspace, table and column names there’s also the type as a symbol (e.g. ‘:varchar`, `:int`, `:date`).
Instance Attribute Summary collapse
-
#column_name ⇒ Object
readonly
Returns the value of attribute column_name.
-
#keyspace ⇒ Object
readonly
Returns the value of attribute keyspace.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(*args) ⇒ ColumnMetadata
constructor
A new instance of ColumnMetadata.
- #to_ary ⇒ Object
Constructor Details
#initialize(*args) ⇒ ColumnMetadata
Returns a new instance of ColumnMetadata.
12 13 14 |
# File 'lib/cql/client/column_metadata.rb', line 12 def initialize(*args) @keyspace, @table, @column_name, @type = args end |
Instance Attribute Details
#column_name ⇒ Object (readonly)
Returns the value of attribute column_name.
9 10 11 |
# File 'lib/cql/client/column_metadata.rb', line 9 def column_name @column_name end |
#keyspace ⇒ Object (readonly)
Returns the value of attribute keyspace.
9 10 11 |
# File 'lib/cql/client/column_metadata.rb', line 9 def keyspace @keyspace end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
9 10 11 |
# File 'lib/cql/client/column_metadata.rb', line 9 def table @table end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/cql/client/column_metadata.rb', line 9 def type @type end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
21 22 23 |
# File 'lib/cql/client/column_metadata.rb', line 21 def eql?(other) self.keyspace == other.keyspace && self.table == other.table && self.column_name == other.column_name && self.type == other.type end |
#hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cql/client/column_metadata.rb', line 26 def hash @h ||= begin h = 0 h = ((h & 33554431) * 31) ^ @keyspace.hash h = ((h & 33554431) * 31) ^ @table.hash h = ((h & 33554431) * 31) ^ @column_name.hash h = ((h & 33554431) * 31) ^ @type.hash h end end |
#to_ary ⇒ Object
17 18 19 |
# File 'lib/cql/client/column_metadata.rb', line 17 def to_ary [@keyspace, @table, @column_name, @type] end |