class PageMeta::HashMetaTag

Public Instance Methods

render() click to toggle source
# File lib/page_meta/hash_meta_tag.rb, line 5
def render
  return if content.empty?

  content.each_with_object([]) do |(attr, value), buffer|
    value = value.call if value.respond_to?(:call)
    value = value.to_s

    next if value.blank?

    attr = attr.to_s.tr("_", ":")

    buffer << helpers.tag(
      :meta,
      property: "#{base_name}:#{attr}",
      content: value
    )
  end.join
end