Class: MetadataPresenter::Page

Inherits:
Metadata
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/models/metadata_presenter/page.rb

Instance Attribute Summary

Attributes inherited from Metadata

#metadata

Instance Method Summary collapse

Methods inherited from Metadata

#editor?, #id, #initialize, #method_missing, #respond_to_missing?, #to_json, #type

Constructor Details

This class inherits a constructor from MetadataPresenter::Metadata

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MetadataPresenter::Metadata

Instance Method Details

#==(other) ⇒ Object



12
13
14
# File 'app/models/metadata_presenter/page.rb', line 12

def ==(other)
  id == other.id if other.respond_to? :id
end

#componentsObject



20
21
22
23
24
# File 'app/models/metadata_presenter/page.rb', line 20

def components
  .components&.map do |component|
    MetadataPresenter::Component.new(component, editor: editor?)
  end
end

#content_componentsObject



38
39
40
# File 'app/models/metadata_presenter/page.rb', line 38

def content_components
  page_components(raw_type)[:content_components]
end

#editable_attributesObject



16
17
18
# File 'app/models/metadata_presenter/page.rb', line 16

def editable_attributes
  to_h.reject { |k, _| k.in?(%i[_id _type steps]) }
end

#input_componentsObject



34
35
36
# File 'app/models/metadata_presenter/page.rb', line 34

def input_components
  page_components(raw_type)[:input_components]
end

#templateObject



30
31
32
# File 'app/models/metadata_presenter/page.rb', line 30

def template
  "metadata_presenter/#{type.gsub('.', '/')}"
end

#to_partial_pathObject



26
27
28
# File 'app/models/metadata_presenter/page.rb', line 26

def to_partial_path
  type.gsub('.', '/')
end

#uuidObject



8
9
10
# File 'app/models/metadata_presenter/page.rb', line 8

def uuid
  _uuid
end