Class: Imageomatic::Opengraph::MetatagMapper
- Inherits:
-
Object
- Object
- Imageomatic::Opengraph::MetatagMapper
- Includes:
- ActionView::Helpers::OutputSafetyHelper
- Defined in:
- app/models/imageomatic/opengraph/metatag_mapper.rb
Overview
Iterates recursively through an OpenGraph object and gets a bunch of metatags and keys.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model) ⇒ MetatagMapper
constructor
A new instance of MetatagMapper.
- #metatags ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(model) ⇒ MetatagMapper
Returns a new instance of MetatagMapper.
12 13 14 |
# File 'app/models/imageomatic/opengraph/metatag_mapper.rb', line 12 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'app/models/imageomatic/opengraph/metatag_mapper.rb', line 8 def model @model end |
Instance Method Details
#metatags ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/imageomatic/opengraph/metatag_mapper.rb', line 16 def Enumerator.new do |y| model.properties.each do |property, content| if content.respond_to? :properties MetatagMapper.new(content)..each do |tag| y << tag end else y << Metatag.new(property.key, content) if content.present? end end end end |
#to_html ⇒ Object
30 31 32 |
# File 'app/models/imageomatic/opengraph/metatag_mapper.rb', line 30 def to_html safe_join .map(&:to_html), "\n" end |