Class: ROM::DynamoDB::Commands::Create

Inherits:
Commands::Create
  • Object
show all
Defined in:
lib/rom/dynamodb/commands/create.rb

Instance Method Summary collapse

Instance Method Details

#execute(tuples) ⇒ Object



7
8
9
10
# File 'lib/rom/dynamodb/commands/create.rb', line 7

def execute(tuples)
  tuples = tuples.is_a?(Array) ? tuples : [tuples]
  tuples.collect(&method(:with_tuple))
end

#with_tuple(tuple) ⇒ Object



12
13
14
15
# File 'lib/rom/dynamodb/commands/create.rb', line 12

def with_tuple(tuple)
  data = tuple.is_a?(Hash) ? tuple : tuple.to_h
  source.create(data)
end