Class: SSDB::Batch

Inherits:
Array
  • Object
show all
Defined in:
lib/ssdb/batch.rb

Instance Method Summary collapse

Constructor Details

#initializeBatch

Constructor



4
5
6
7
# File 'lib/ssdb/batch.rb', line 4

def initialize
  @futures = []
  super
end

Instance Method Details

#call(opts) ⇒ Object

Call command

Parameters:

  • opts (Hash)

    the command options



11
12
13
14
15
16
17
# File 'lib/ssdb/batch.rb', line 11

def call(opts)
  push(opts)

  future = SSDB::Future.new(opts[:cmd])
  @futures.push(future)
  future
end

#values=(values) ⇒ Object

Parameters:

  • values (Array)


20
21
22
23
24
25
# File 'lib/ssdb/batch.rb', line 20

def values=(values)
  values.each_with_index do |value, index|
    future = @futures[index]
    future.value = value if future
  end
end