Module: SchoolieHelper

Defined in:
lib/helpers/schoolie_helper.rb

Overview

though can be overridden

Instance Method Summary collapse

Instance Method Details

#schoolie_tags(concern, config = Rails.root.join("config/schoolie.yml")) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/helpers/schoolie_helper.rb', line 8

def schoolie_tags(concern, config = Rails.root.join("config/schoolie.yml"))
  m = load_map(config)
  tags = m["static"].map do |k, v|
    tag.meta(name: k, value: v)
  end
  tags =  m["attributes"].inject(tags) do |m, (k, v)|
    begin
      [concern.send(v)].flatten.each do |z|
        m << tag.meta(name: k, value: z)
      end
      rescue StandardError
        warn("Undefined attribute mapping: #{k} -> #{v}")
      end
    m
    end
  tags.join("\n")
end