Class: MetadataPresenter::Metadata

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion
Defined in:
app/models/metadata_presenter/metadata.rb

Direct Known Subclasses

Component, Page, Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Metadata

Returns a new instance of Metadata.



7
8
9
# File 'app/models/metadata_presenter/metadata.rb', line 7

def initialize()
  @metadata = OpenStruct.new()
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



27
28
29
# File 'app/models/metadata_presenter/metadata.rb', line 27

def method_missing(method_name, *args, &block)
  .send(method_name, *args, &block)
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



5
6
7
# File 'app/models/metadata_presenter/metadata.rb', line 5

def 
  @metadata
end

Instance Method Details

#idObject



15
16
17
# File 'app/models/metadata_presenter/metadata.rb', line 15

def id
  ._id
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/metadata_presenter/metadata.rb', line 23

def respond_to_missing?(method_name, include_private = false)
  .respond_to?(method_name)
end

#to_jsonObject



11
12
13
# File 'app/models/metadata_presenter/metadata.rb', line 11

def to_json
  self.to_h.to_json
end

#typeObject



19
20
21
# File 'app/models/metadata_presenter/metadata.rb', line 19

def type
  ._type
end