Class: Aerospike::BatchItem

Inherits:
Object
  • Object
show all
Defined in:
lib/aerospike/command/batch_item.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, indexes) ⇒ BatchItem

Returns a new instance of BatchItem.



34
35
36
37
# File 'lib/aerospike/command/batch_item.rb', line 34

def initialize(key, indexes)
  @key = key
  @indexes = indexes
end

Instance Attribute Details

#indexesObject

Returns the value of attribute indexes.



23
24
25
# File 'lib/aerospike/command/batch_item.rb', line 23

def indexes
  @indexes
end

#keyObject

Returns the value of attribute key.



22
23
24
# File 'lib/aerospike/command/batch_item.rb', line 22

def key
  @key
end

Class Method Details

.generate_map(keys) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/aerospike/command/batch_item.rb', line 25

def self.generate_map(keys)
  map = keys.each_with_index
    .group_by { |key, _| key }
    .map { |key, keys_with_idx|
      [key.digest, BatchItem.new(key, keys_with_idx.map(&:last))]
    }
  map.to_h
end

Instance Method Details

#indexObject



39
40
41
# File 'lib/aerospike/command/batch_item.rb', line 39

def index
  indexes.shift
end