lib/rom/memory/commands.rb in rom-0.7.0 vs lib/rom/memory/commands.rb in rom-0.7.1
- old
+ new
@@ -8,10 +8,12 @@
module Commands
# In-memory create command
#
# @api public
class Create < ROM::Commands::Create
+ adapter :memory
+
# @see ROM::Commands::Create#execute
def execute(tuple)
attributes = input[tuple]
validator.call(attributes)
[relation.insert(attributes.to_h).to_a.last]
@@ -20,10 +22,12 @@
# In-memory update command
#
# @api public
class Update < ROM::Commands::Update
+ adapter :memory
+
# @see ROM::Commands::Update#execute
def execute(params)
attributes = input[params]
validator.call(attributes)
relation.map { |tuple| tuple.update(attributes.to_h) }
@@ -32,9 +36,11 @@
# In-memory delete command
#
# @api public
class Delete < ROM::Commands::Delete
+ adapter :memory
+
# @see ROM::Commands::Delete#execute
def execute
tuples = target.to_a
tuples.each do |tuple|
relation.delete(tuple)