Class: Ecoportal::API::V2::Page::Force::Binding
- Inherits:
-
Common::Content::DoubleModel
- Object
- Common::BaseModel
- Common::Content::DoubleModel
- Ecoportal::API::V2::Page::Force::Binding
- Defined in:
- lib/ecoportal/api/v2/page/force/binding.rb
Constant Summary collapse
- COMPONENT_TYPE =
"membrane_binding"
- SECTION_TYPE =
"flow_node_binding"
Constants inherited from Common::Content::DoubleModel
Common::Content::DoubleModel::NOT_USED
Constants included from Common::Content::ClassHelpers
Common::Content::ClassHelpers::NOT_USED
Instance Attribute Summary
Attributes inherited from Common::Content::DoubleModel
Class Method Summary collapse
Instance Method Summary collapse
-
#component ⇒ Ecoportal::API::V2::Page::Component
Field referenced by this binding.
-
#component? ⇒ Boolean
Whether or not this the binding refers to a Component.
- #delete! ⇒ Object
- #force ⇒ Object
- #ooze ⇒ Object
- #reference ⇒ Ecoportal::API::V2::Page::Component, Ecoportal::API::V2::Page::Section
- #replace(mem_sec) ⇒ Object
-
#section ⇒ Ecoportal::API::V2::Page::Section
Section referenced by this binding.
-
#section? ⇒ Boolean
Whether or not this the binding refers to a Section.
Methods inherited from Common::Content::DoubleModel
#_doc_key, #as_json, #as_update, #consolidate!, #dirty?, #doc, embeds_many, embeds_one, enforce!, #initialize, #key, #key=, key?, new_uuid, #original_doc, pass_reader, pass_writer, passarray, passboolean, passdate, passforced, passkey, passthrough, #print_pretty, read_only!, read_only?, #read_only?, #replace_doc, #reset!, #resolved_doc_key, #root, #to_json
Methods included from Common::Content::ClassHelpers
#inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant, #to_time, #uid, #used_param?
Constructor Details
This class inherits a constructor from Ecoportal::API::Common::Content::DoubleModel
Class Method Details
.new_doc ⇒ Object
8 9 10 11 12 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 8 def new_doc { "id" => new_uuid } end |
Instance Method Details
#component ⇒ Ecoportal::API::V2::Page::Component
Returns field referenced by this binding.
40 41 42 43 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 40 def component raise "This is not a component binding, but a section binding" unless component? ooze.components.get_by_id(reference_id) end |
#component? ⇒ Boolean
Returns whether or not this the binding refers to a Component.
30 31 32 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 30 def component? type == COMPONENT_TYPE end |
#delete! ⇒ Object
62 63 64 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 62 def delete! self._parent.delete!(self) end |
#force ⇒ Object
25 26 27 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 25 def force self._parent.force end |
#ooze ⇒ Object
21 22 23 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 21 def ooze self._parent.ooze end |
#reference ⇒ Ecoportal::API::V2::Page::Component, Ecoportal::API::V2::Page::Section
52 53 54 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 52 def reference self.component? ? component : section end |
#replace(mem_sec) ⇒ Object
56 57 58 59 60 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 56 def replace(mem_sec) self._parent.add(mem_sec, name: self.name, before: self) do |bind| self.delete! if bind end end |
#section ⇒ Ecoportal::API::V2::Page::Section
Returns section referenced by this binding.
46 47 48 49 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 46 def section raise "This is not a section binding, but a component binding" unless section? ooze.sections.get_by_id(reference_id) end |
#section? ⇒ Boolean
Returns whether or not this the binding refers to a Section.
35 36 37 |
# File 'lib/ecoportal/api/v2/page/force/binding.rb', line 35 def section? type == SECTION_TYPE end |