Class: Ecoportal::API::Common::Content::CollectionModel

Inherits:
DoubleModel
  • Object
show all
Includes:
Doc, DocMutation, Model, Modifiers, Mutation
Defined in:
lib/ecoportal/api/common/content/collection_model.rb,
lib/ecoportal/api/common/content/collection_model/doc.rb,
lib/ecoportal/api/common/content/collection_model/model.rb,
lib/ecoportal/api/common/content/collection_model/mutation.rb,
lib/ecoportal/api/common/content/collection_model/doc/items.rb,
lib/ecoportal/api/common/content/collection_model/modifiers.rb,
lib/ecoportal/api/common/content/collection_model/model/cache.rb,
lib/ecoportal/api/common/content/collection_model/model/items.rb,
lib/ecoportal/api/common/content/collection_model/doc_mutation.rb,
lib/ecoportal/api/common/content/collection_model/model/lookup.rb,
lib/ecoportal/api/common/content/collection_model/doc/rooted_key.rb,
lib/ecoportal/api/common/content/collection_model/model/iterable.rb,
lib/ecoportal/api/common/content/collection_model/mutation/clear.rb,
lib/ecoportal/api/common/content/collection_model/mutation/delete.rb,
lib/ecoportal/api/common/content/collection_model/mutation/upsert.rb,
lib/ecoportal/api/common/content/collection_model/model/numeric_key.rb,
lib/ecoportal/api/common/content/collection_model/model/var_tracking.rb,
lib/ecoportal/api/common/content/collection_model/doc_mutation/delete.rb,
lib/ecoportal/api/common/content/collection_model/doc_mutation/upsert.rb,
lib/ecoportal/api/common/content/collection_model/modifiers/items_key.rb,
lib/ecoportal/api/common/content/collection_model/doc_mutation/position.rb,
lib/ecoportal/api/common/content/collection_model/modifiers/items_klass.rb,
lib/ecoportal/api/common/content/collection_model/modifiers/items_order.rb

Overview

Note:

to be able to refer to the correct element of the Collection, it is required that those elements have a unique key that allows to identify them

CollectionModel aims to deal with Arrays of actual objects.

Defined Under Namespace

Modules: Doc, DocMutation, Model, Modifiers, Mutation

Constant Summary

Constants included from DoubleModel::Diffable

DoubleModel::Diffable::DIFF_CLASS

Constants included from DoubleModel::Base

DoubleModel::Base::NOT_USED

Instance Attribute Summary

Attributes included from DoubleModel::Parented

#_parent, #_parent_key

Instance Method Summary collapse

Methods included from Includer

#include_missing

Methods inherited from DoubleModel

new_uuid

Methods included from DoubleModel::Diffable

#as_update, #dirty?

Constructor Details

#initialize(ini_doc = [], parent: self, key: nil, read_only: false) ⇒ CollectionModel

Returns a new instance of CollectionModel.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ecoportal/api/common/content/collection_model.rb', line 21

def initialize(
  ini_doc = [],
  parent:    self,
  key:       nil,
  read_only: false
)
  msg = "Undefined base 'klass' or 'new_item' callback for #{self.class}"
  raise msg unless self.class.klass?

  ini_doc = to_ini_doc(ini_doc)

  super
end