Class: CassandraCQL::Collections::List

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra-cql/collections/list.rb

Direct Known Subclasses

Set

Class Method Summary collapse

Class Method Details

.cast(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/cassandra-cql/collections/list.rb', line 4

def self.cast(value)
  length = value.unpack('S>').first
  pos = 2
  Array.new(length) do
    value_length = value.byteslice(pos, 2).unpack('S>').first
    pos += 2
    element = value.byteslice(pos, value_length)
    pos += value_length
    yield element
  end
end