lib/aerospike/command/read_command.rb in aerospike-2.6.0 vs lib/aerospike/command/read_command.rb in aerospike-2.7.0
- old
+ new
@@ -1,6 +1,7 @@
-# encoding: utf-8
+# frozen_string_literal: true
+
# Copyright 2014-2017 Aerospike, Inc.
#
# Portions may be licensed to Aerospike, Inc. under one or more contributor
# license agreements.
#
@@ -23,10 +24,11 @@
module Aerospike
private
class ReadCommand < SingleCommand #:nodoc:
+ BIN_NAME_ENCODING = 'utf-8'
attr_reader :record, :policy
def initialize(cluster, policy, key, bin_names)
super(cluster, key)
@@ -125,10 +127,10 @@
i = 0
while i < op_count
op_size = @data_buffer.read_int32(receive_offset)
particle_type = @data_buffer.read(receive_offset+5).ord
name_size = @data_buffer.read(receive_offset+7).ord
- name = @data_buffer.read(receive_offset+8, name_size).force_encoding('utf-8')
+ name = @data_buffer.read(receive_offset+8, name_size).force_encoding(BIN_NAME_ENCODING)
receive_offset += 4 + 4 + name_size
particle_bytes_size = op_size - (4 + name_size)
value = Aerospike.bytes_to_particle(particle_type, @data_buffer, receive_offset, particle_bytes_size)
receive_offset += particle_bytes_size