Class: Cql::Client::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/cql/client/synchronous_prepared_statement.rb

Instance Method Summary collapse

Constructor Details

#initialize(async_statement) ⇒ Pipeline

Returns a new instance of Pipeline.



29
30
31
32
# File 'lib/cql/client/synchronous_prepared_statement.rb', line 29

def initialize(async_statement)
  @async_statement = async_statement
  @futures = []
end

Instance Method Details

#execute(*args) ⇒ Object



34
35
36
# File 'lib/cql/client/synchronous_prepared_statement.rb', line 34

def execute(*args)
  @futures << @async_statement.execute(*args)
end

#getObject



38
39
40
41
42
43
44
# File 'lib/cql/client/synchronous_prepared_statement.rb', line 38

def get
  if @futures.any?
    Future.combine(*@futures).get
  else
    []
  end
end