class Cequel::Schema::Map
A Map
column
@see
http://cassandra.apache.org/doc/cql3/CQL.html#map CQL documentation for map columns
Attributes
key_type[R]
@return [Type] the type of keys in this map
Public Class Methods
new(name, key_type, value_type)
click to toggle source
@param name [Symbol] name of this column @param key_type
[Type] type of the keys in the map @param value_type [Type] type of the values in the map
Calls superclass method
Cequel::Schema::Column::new
# File lib/cequel/schema/column.rb, line 282 def initialize(name, key_type, value_type) super(name, value_type) @key_type = key_type end
Public Instance Methods
cast(value)
click to toggle source
@param (see Column#cast
) @return [Hash] hash with keys and values cast to correct type for
column
# File lib/cequel/schema/column.rb, line 297 def cast(value) value.each_with_object({}) do |(key, element), hash| hash[@key_type.cast(key)] = @type.cast(element) end end
to_cql()
click to toggle source
(see Column#to_cql
)
# File lib/cequel/schema/column.rb, line 288 def to_cql "#{@name} MAP <#{@key_type}, #{@type}>" end