Class: Ecoportal::API::Common::Content::DoubleModel
- Inherits:
-
BaseModel
- Object
- BaseModel
- Ecoportal::API::Common::Content::DoubleModel
- Includes:
- Attributable, Base, Diffable, DoubleDoc, HashHelpers, Modifiers, Parented, VarTracking
- Defined in:
- lib/ecoportal/api/common/content/double_model.rb,
lib/ecoportal/api/common/content/double_model/base.rb,
lib/ecoportal/api/common/content/double_model/diffable.rb,
lib/ecoportal/api/common/content/double_model/parented.rb,
lib/ecoportal/api/common/content/double_model/modifiers.rb,
lib/ecoportal/api/common/content/double_model/double_doc.rb,
lib/ecoportal/api/common/content/double_model/attributable.rb,
lib/ecoportal/api/common/content/double_model/hash_helpers.rb,
lib/ecoportal/api/common/content/double_model/var_tracking.rb,
lib/ecoportal/api/common/content/double_model/double_doc/base.rb,
lib/ecoportal/api/common/content/double_model/attributable/base.rb,
lib/ecoportal/api/common/content/double_model/modifiers/rootable.rb,
lib/ecoportal/api/common/content/double_model/attributable/simple.rb,
lib/ecoportal/api/common/content/double_model/attributable/enforce.rb,
lib/ecoportal/api/common/content/double_model/attributable/nesting.rb,
lib/ecoportal/api/common/content/double_model/double_doc/rooted_key.rb,
lib/ecoportal/api/common/content/double_model/double_doc/linkable_doc.rb,
lib/ecoportal/api/common/content/double_model/attributable/passthrough.rb,
lib/ecoportal/api/common/content/double_model/modifiers/read_only_able.rb,
lib/ecoportal/api/common/content/double_model/double_doc/replaceable_doc.rb,
lib/ecoportal/api/common/content/double_model/double_doc/reset_consolidate.rb
Overview
Basic model class, to build get / set methods for a given property
which differs of attr_* ruby native class methods because pass*
completelly links the methods to a subjacent Hash model
Direct Known Subclasses
ArrayModel, CollectionModel, V2::Page, V2::Page::Component, V2::Page::Component::Action, V2::Page::Component::ChartField::Config, V2::Page::Component::ChecklistItem, V2::Page::Component::File, V2::Page::Component::GaugeStop, V2::Page::Component::GeoCoordinates, V2::Page::Component::Image, V2::Page::Component::Law, V2::Page::Component::PeopleViewableField, V2::Page::Component::SelectionOption, V2::Page::Force, V2::Page::Force::Binding, V2::Page::Force::Helper, V2::Page::MouldCounter, V2::Page::PermissionFlags, V2::Page::Permit, V2::Page::Section, V2::Page::Stage, V2::Pages::PageCreateResponse, V2::Pages::PageStage::Task, V2::Registers::PageResult, V2::Registers::PageResult::MembraneDroplet, V2::Registers::Register, V2::Registers::SearchResults, V2::Registers::StageResult, V2::Registers::Template, V2::S3::Data, V2::S3::Files::Poll, V2::S3::Files::PollStatus, V2::S3::Files::PollStatus::FileContainer
Defined Under Namespace
Modules: Attributable, Base, Diffable, DoubleDoc, HashHelpers, Modifiers, Parented, VarTracking
Constant Summary
Constants included from Diffable
Constants included from Base
Instance Attribute Summary
Attributes included from Parented
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(doc = {}, parent: self, key: nil, read_only: self.class.read_only?) ⇒ DoubleModel
constructor
rubocop:disable Lint/MissingSuper.
Methods included from Diffable
Methods included from Includer
Constructor Details
#initialize(doc = {}, parent: self, key: nil, read_only: self.class.read_only?) ⇒ DoubleModel
rubocop:disable Lint/MissingSuper
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ecoportal/api/common/content/double_model.rb', line 34 def initialize(doc = {}, parent: self, key: nil, read_only: self.class.read_only?) # rubocop:disable Lint/MissingSuper self._parent = parent || self self._parent_key = key || self read_only! if read_only self.class.enforce!(doc) if to_be_root? @doc = JSON.parse(doc.to_json) @original_doc = JSON.parse(@doc.to_json) end return unless key_method? && doc.is_a?(Hash) # ensure it is well linked! (so: throw error if something is wrong!) # and ensure the below does not create an infinite loop self.key = doc[key_method] #puts "\n$(#{self.key}<=>#{self.class})" end |
Class Method Details
.new_uuid(length: 24) ⇒ Object
29 30 31 |
# File 'lib/ecoportal/api/common/content/double_model.rb', line 29 def new_uuid(length: 24) uid(length) end |