Class: PageMeta::HashMetaTag

Inherits:
MetaTag
  • Object
show all
Defined in:
lib/page_meta/hash_meta_tag.rb

Direct Known Subclasses

MetaTag::Og, MetaTag::Twitter

Instance Attribute Summary

Attributes inherited from MetaTag

#content, #name

Instance Method Summary collapse

Methods inherited from MetaTag

build, #helpers, #initialize

Constructor Details

This class inherits a constructor from PageMeta::MetaTag

Instance Method Details

#renderObject



5
6
7
8
9
10
11
12
13
# File 'lib/page_meta/hash_meta_tag.rb', line 5

def render
  return if content.empty?

  content.each_with_object([]) do |(attr, value), buffer|
    next if value.blank?
    attr = attr.to_s.tr("_", ":")
    buffer << helpers.tag(:meta, property: "#{base_name}:#{attr}", content: value)
  end.join
end