Class: Cuprum::Collections::Commands::Create
- Inherits:
-
Cuprum::Command
- Object
- Cuprum::Command
- Cuprum::Collections::Commands::Create
- Defined in:
- lib/cuprum/collections/commands/create.rb
Overview
Command for building, validating and inserting an entity into a collection.
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
The collection used to store the entity.
-
#contract ⇒ Stannum::Constraint
readonly
The constraint used to validate the entity.
Instance Method Summary collapse
-
#initialize(collection:, contract: nil) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(collection:, contract: nil) ⇒ Create
Returns a new instance of Create.
37 38 39 40 41 42 |
# File 'lib/cuprum/collections/commands/create.rb', line 37 def initialize(collection:, contract: nil) super() @collection = collection @contract = contract end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the collection used to store the entity.
45 46 47 |
# File 'lib/cuprum/collections/commands/create.rb', line 45 def collection @collection end |
#contract ⇒ Stannum::Constraint (readonly)
Returns the constraint used to validate the entity.
48 49 50 |
# File 'lib/cuprum/collections/commands/create.rb', line 48 def contract @contract end |