Class: Alchemy::JsonApi::Page

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/alchemy/json_api/page.rb

Instance Method Summary collapse

Constructor Details

#initialize(page, page_version: :public_version) ⇒ Page

Returns a new instance of Page.


4
5
6
7
# File 'app/models/alchemy/json_api/page.rb', line 4

def initialize(page, page_version: :public_version)
  @page_version = page.public_send(page_version)
  super(page)
end

Instance Method Details

#all_element_idsObject


24
25
26
# File 'app/models/alchemy/json_api/page.rb', line 24

def all_element_ids
  @_all_element_ids ||= all_elements.map(&:id)
end

#all_elementsObject

All elements including nested and fixed elements


10
11
12
# File 'app/models/alchemy/json_api/page.rb', line 10

def all_elements
  @_all_elements ||= element_repository
end

#element_idsObject


28
29
30
# File 'app/models/alchemy/json_api/page.rb', line 28

def element_ids
  @_element_ids ||= elements.map(&:id)
end

#elementsObject

Not nested unfixed top level elements


15
16
17
# File 'app/models/alchemy/json_api/page.rb', line 15

def elements
  @_elements ||= element_repository.not_nested.unfixed
end

#fixed_element_idsObject


32
33
34
# File 'app/models/alchemy/json_api/page.rb', line 32

def fixed_element_ids
  @_fixed_element_ids ||= fixed_elements.map(&:id)
end

#fixed_elementsObject

Not nested fixed top level elements


20
21
22
# File 'app/models/alchemy/json_api/page.rb', line 20

def fixed_elements
  @_fixed_elements ||= element_repository.not_nested.fixed
end