Sha256: cd72710be44390e7c53960cf198e6cb3984a7bb653233fa5a59842904bfc254e
Contents?: true
Size: 766 Bytes
Versions: 4
Compression:
Stored size: 766 Bytes
Contents
module Rails module MetaTags module ModelSupport class Data attr_reader :config, :model def initialize(config, model) @config, @model = config, model end PROPERTIES.each do |t| class_eval "def #{t}; self[:#{t}]; end" end def [](tag) if config[tag].is_a?(Symbol) model.send(config[tag]) elsif config[tag].respond_to?(:call) config[tag].call(model) else config[tag] end end def to_hash result = {} config.to_hash.keys.each do |k| result[k] = self[k] if self[k].present? end result end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems