class Para::SeoTools::MetaTags::Tags::Base

Attributes

controller[RW]

Public Class Methods

new(controller) click to toggle source
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 8
def initialize(controller)
  @controller = controller
end
process(value) click to toggle source

Overriding this method in subclasses allow to process the meta tag value before it is rendered, e.g. stripping HTML tags

# File lib/para/seo_tools/meta_tags/tags/base.rb, line 15
def self.process(value)
  value
end

Protected Instance Methods

action_i18n(label) click to toggle source
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 25
def action_i18n(label)
  I18n.t(action_key(label), default: '').presence
end
action_key(label) click to toggle source
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 29
def action_key(label)
  key = %w(meta_tags controller)
  key << controller.params[:controller]
  key << controller.params[:action]
  key << label
  key.join(".")
end
instance() click to toggle source

TODO : Define if we'll still support instance meta tags and refactor

accordingly
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 39
def instance
end
member_action?() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 21
def member_action?
  controller.params.key?(:id)
end
model_name() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/base.rb, line 42
def model_name
  @model_name ||= controller.class.name.gsub(/Controller$/, '').singularize.underscore
end