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

#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

#humanised_titleObject



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

def humanised_title
  self.label || self.legend
end

#itemsObject



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

def items
  .items.map do |item|
    OpenStruct.new(
      id: item['label'],
      name: item['label'],
      description: item['hint']
    )
  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