Class: LiquidComponent::Metadata
- Inherits:
-
Object
- Object
- LiquidComponent::Metadata
- Defined in:
- lib/liquid-component/metadata.rb
Instance Attribute Summary collapse
-
#additional ⇒ Object
Returns the value of attribute additional.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#variables ⇒ Object
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize(metadata) ⇒ Metadata
constructor
A new instance of Metadata.
- #to_h ⇒ Object
Constructor Details
#initialize(metadata) ⇒ Metadata
Returns a new instance of Metadata.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/liquid-component/metadata.rb', line 7 def initialize() = .with_indifferent_access self.name = [:name] self.description = [:description] self.variables = Variable.parse([:variables]) .delete(:name) .delete(:description) .delete(:variables) self.additional = end |
Instance Attribute Details
#additional ⇒ Object
Returns the value of attribute additional.
5 6 7 |
# File 'lib/liquid-component/metadata.rb', line 5 def additional @additional end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/liquid-component/metadata.rb', line 5 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/liquid-component/metadata.rb', line 5 def name @name end |
#variables ⇒ Object
Returns the value of attribute variables.
5 6 7 |
# File 'lib/liquid-component/metadata.rb', line 5 def variables @variables end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/liquid-component/metadata.rb', line 21 def to_h h = {} h[:name] = name if name h[:description] = description if description h[:variables] = variables.map(&:to_h) h[:additional] = additional h end |