Class: MetadataPresenter::Component

Inherits:
Metadata
  • Object
show all
Defined in:
app/models/metadata_presenter/component.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

#content?Boolean

Returns:

  • (Boolean)


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

def content?
  type == 'content'
end

#humanised_titleObject



6
7
8
# File 'app/models/metadata_presenter/component.rb', line 6

def humanised_title
  label || legend
end

#itemsObject



10
11
12
13
14
# File 'app/models/metadata_presenter/component.rb', line 10

def items
  .items.map do |item|
    MetadataPresenter::Item.new(item, editor: editor?)
  end
end

#to_partial_pathObject



2
3
4
# File 'app/models/metadata_presenter/component.rb', line 2

def to_partial_path
  "metadata_presenter/component/#{type}"
end