Sha256: 08e22064711fa0eb7eeaaa7174264ae41fd7f5ef18b607d1639e43c84202e18c

Contents?: true

Size: 406 Bytes

Versions: 3

Compression:

Stored size: 406 Bytes

Contents

module CassandraCQL
  module Collections
    class List
      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cassandra-cql-1.2.2 lib/cassandra-cql/collections/list.rb
cassandra-cql-1.2.1 lib/cassandra-cql/collections/list.rb
cassandra-cql-1.2.0 lib/cassandra-cql/collections/list.rb