Class: Lotus::Model::Adapters::Memory::Command Private
- Inherits:
-
Object
- Object
- Lotus::Model::Adapters::Memory::Command
- Defined in:
- lib/lotus/model/adapters/memory/command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Execute a command for the given collection.
Instance Method Summary collapse
-
#clear ⇒ Object
private
Deletes all the records from the table.
-
#create(entity) ⇒ Object
private
Creates a record for the given entity.
-
#delete(entity) ⇒ Object
private
Deletes the corresponding record for the given entity.
-
#initialize(dataset, collection) ⇒ Command
constructor
private
Initialize a command.
-
#update(entity) ⇒ Object
private
Updates the corresponding record for the given entity.
Constructor Details
#initialize(dataset, collection) ⇒ Command
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a command
20 21 22 23 |
# File 'lib/lotus/model/adapters/memory/command.rb', line 20 def initialize(dataset, collection) @dataset = dataset @collection = collection end |
Instance Method Details
#clear ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deletes all the records from the table.
75 76 77 |
# File 'lib/lotus/model/adapters/memory/command.rb', line 75 def clear @dataset.clear end |
#create(entity) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a record for the given entity.
35 36 37 38 39 40 |
# File 'lib/lotus/model/adapters/memory/command.rb', line 35 def create(entity) serialized_entity = _serialize(entity) serialized_entity[_identity] = @dataset.create(serialized_entity) _deserialize(serialized_entity) end |
#delete(entity) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deletes the corresponding record for the given entity.
65 66 67 |
# File 'lib/lotus/model/adapters/memory/command.rb', line 65 def delete(entity) @dataset.delete(entity) end |
#update(entity) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Updates the corresponding record for the given entity.
50 51 52 53 54 55 |
# File 'lib/lotus/model/adapters/memory/command.rb', line 50 def update(entity) serialized_entity = _serialize(entity) @dataset.update(serialized_entity) _deserialize(serialized_entity) end |