Class: Crystal::Tag
- Inherits:
-
Struct
- Object
- Struct
- Crystal::Tag
- Defined in:
- lib/crystal/tag.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/crystal/tag.rb', line 2 def name @name end |
#value ⇒ Object
Returns the value of attribute value
2 3 4 |
# File 'lib/crystal/tag.rb', line 2 def value @value end |
Instance Method Details
#name_key ⇒ Object
3 4 5 |
# File 'lib/crystal/tag.rb', line 3 def name_key name.starts_with?('og:') ? :property : :name end |
#value_for_context(context) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/crystal/tag.rb', line 7 def value_for_context(context) case when asset? context.send(asset_path_method, value) when value.acts_like?(:time) value.iso8601 when value.acts_like?(:date) value.strftime('%Y-%m-%d') else value end end |