Module: Metaslug::ActionViewExtension

Defined in:
lib/metaslug/helpers/action_view_extension.rb

Instance Method Summary collapse

Instance Method Details

#metaslugObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/metaslug/helpers/action_view_extension.rb', line 3

def metaslug
  @metaslug.inject([]) do |acc, (k, v)|
    if 'title' == k.to_s
      acc << (:title, @metaslug['title'])
    elsif v.is_a?(Hash)
      # more complicated metas, like property
      set_metas_from_hash(v, k, acc)
    else
      acc << tag(:meta, { name: k.to_s, content: @metaslug[k.to_s] }, true )
    end
    acc
  end.join.html_safe
end