Class: Alchemy::JsonApi::Page
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Alchemy::JsonApi::Page
- Defined in:
- app/models/alchemy/json_api/page.rb
Instance Attribute Summary collapse
-
#page_version ⇒ Object
readonly
Returns the value of attribute page_version.
-
#page_version_type ⇒ Object
readonly
Returns the value of attribute page_version_type.
Instance Method Summary collapse
- #all_element_ids ⇒ Object
-
#all_elements ⇒ Object
All elements including nested and fixed elements.
- #ancestor_ids ⇒ Object
- #element_ids ⇒ Object
-
#elements ⇒ Object
Not nested unfixed top level elements.
- #fixed_element_ids ⇒ Object
-
#fixed_elements ⇒ Object
Not nested fixed top level elements.
-
#initialize(page, page_version_type: :public_version) ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize(page, page_version_type: :public_version) ⇒ Page
Returns a new instance of Page.
12 13 14 15 16 |
# File 'app/models/alchemy/json_api/page.rb', line 12 def initialize(page, page_version_type: :public_version) @page_version_type = page_version_type @page_version = page.public_send(page_version_type) super(page) end |
Instance Attribute Details
#page_version ⇒ Object (readonly)
Returns the value of attribute page_version.
10 11 12 |
# File 'app/models/alchemy/json_api/page.rb', line 10 def page_version @page_version end |
#page_version_type ⇒ Object (readonly)
Returns the value of attribute page_version_type.
10 11 12 |
# File 'app/models/alchemy/json_api/page.rb', line 10 def page_version_type @page_version_type end |
Instance Method Details
#all_element_ids ⇒ Object
33 34 35 |
# File 'app/models/alchemy/json_api/page.rb', line 33 def all_element_ids @_all_element_ids ||= all_elements.map(&:id) end |
#all_elements ⇒ Object
All elements including nested and fixed elements
19 20 21 |
# File 'app/models/alchemy/json_api/page.rb', line 19 def all_elements @_all_elements ||= element_repository end |
#ancestor_ids ⇒ Object
45 46 47 |
# File 'app/models/alchemy/json_api/page.rb', line 45 def ancestor_ids @_ancestor_ids ||= ancestors.map(&:id) end |
#element_ids ⇒ Object
37 38 39 |
# File 'app/models/alchemy/json_api/page.rb', line 37 def element_ids @_element_ids ||= elements.map(&:id) end |
#elements ⇒ Object
Not nested unfixed top level elements
24 25 26 |
# File 'app/models/alchemy/json_api/page.rb', line 24 def elements @_elements ||= element_repository.not_nested.unfixed end |
#fixed_element_ids ⇒ Object
41 42 43 |
# File 'app/models/alchemy/json_api/page.rb', line 41 def fixed_element_ids @_fixed_element_ids ||= fixed_elements.map(&:id) end |
#fixed_elements ⇒ Object
Not nested fixed top level elements
29 30 31 |
# File 'app/models/alchemy/json_api/page.rb', line 29 def fixed_elements @_fixed_elements ||= element_repository.not_nested.fixed end |