Sha256: b82f509d2e5c4430049ae168d1c7fff02591c951b79036e9e5154be8fa33a27f
Contents?: true
Size: 649 Bytes
Versions: 3
Compression:
Stored size: 649 Bytes
Contents
module CassandraCQL module Collections class Map def self.cast(value) length = value.unpack('S>').first pos = 2 result = {} length.times do key_length = value.byteslice(pos, 2).unpack('S>').first pos += 2 key = value.byteslice(pos, key_length) pos += key_length val_length = value.byteslice(pos, 2).unpack('S>').first pos += 2 val = value.byteslice(pos, val_length) pos += val_length cast_key, cast_val = yield key, val result[cast_key] = cast_val end result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cassandra-cql-1.2.2 | lib/cassandra-cql/collections/map.rb |
cassandra-cql-1.2.1 | lib/cassandra-cql/collections/map.rb |
cassandra-cql-1.2.0 | lib/cassandra-cql/collections/map.rb |