Class: Dimples::Metadata
- Inherits:
-
Object
- Object
- Dimples::Metadata
- Defined in:
- lib/dimples/metadata.rb
Overview
A tiny wrapper around metadata for rendering
Instance Method Summary collapse
-
#initialize(source) ⇒ Metadata
constructor
A new instance of Metadata.
- #method_missing(_method_name, *_args) ⇒ Object
- #respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(source) ⇒ Metadata
Returns a new instance of Metadata.
6 7 8 9 10 11 |
# File 'lib/dimples/metadata.rb', line 6 def initialize(source) source.each do |key, value| self.class.send(:attr_reader, key) instance_variable_set("@#{key}", value.is_a?(Hash) ? Metadata.new(value) : value) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method_name, *_args) ⇒ Object
13 14 15 |
# File 'lib/dimples/metadata.rb', line 13 def method_missing(_method_name, *_args) nil end |
Instance Method Details
#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
17 18 19 |
# File 'lib/dimples/metadata.rb', line 17 def respond_to_missing?(_method_name, _include_private = false) true end |