Class: Cuprum::Collections::Basic::Commands::UpdateOne

Inherits:
Cuprum::Collections::Basic::Command show all
Defined in:
lib/cuprum/collections/basic/commands/update_one.rb

Overview

Command for updating an entity in the collection.

Instance Attribute Summary

Attributes inherited from CollectionCommand

#collection

Instance Method Summary collapse

Methods inherited from Cuprum::Collections::Basic::Command

#data, #default_contract

Methods inherited from CollectionCommand

#initialize, #name, #primary_key_name, #primary_key_type, #query, #singular_name

Constructor Details

This class inherits a constructor from Cuprum::Collections::CollectionCommand

Instance Method Details

#call(entity:) ⇒ Cuprum::Result<Hash>

Updates the entity in the collection.

If the collection does not already have an entity with the same primary key, #call will fail and the collection will not be updated.

Parameters:

  • entity (Hash)

    The collection entity to persist.

Returns:

  • (Cuprum::Result<Hash>)

    the persisted entity.



21
# File 'lib/cuprum/collections/basic/commands/update_one.rb', line 21

validate :entity