module ActiveSeo::Meta

Public Instance Methods

define_seo_locale_accessors() click to toggle source
# File lib/active_seo/meta.rb, line 60
def define_seo_locale_accessors
  return unless seo_locale_accessors?

  I18n.available_locales.each do |locale|
    attr_name = "seo_meta_#{locale.to_s.downcase.tr('-', '_')}"

    define_method attr_name do
      instance_variable_get("@#{attr_name}") ||
      instance_variable_set("@#{attr_name}", ActiveSeo::SeoMeta.new(self, locale).result)
    end
  end
end
define_seo_validations() click to toggle source
# File lib/active_seo/meta.rb, line 54
def define_seo_validations
  validates :seo_title, length: { maximum: seo_config.title_limit }, allow_blank: true
  validates :seo_description, length: { maximum: seo_config.description_limit }, allow_blank: true
  validates :seo_keywords, length: { maximum: seo_config.keywords_limit }, allow_blank: true
end
seo_class_name() click to toggle source
# File lib/active_seo/meta.rb, line 37
def seo_class_name
  @seo_class_name ||= ActiveSeo.config.class_name
end
seo_contextualizer(name) click to toggle source
# File lib/active_seo/meta.rb, line 50
def seo_contextualizer(name)
  self.seo_context = name
end
seo_locale_accessors?() click to toggle source
# File lib/active_seo/meta.rb, line 41
def seo_locale_accessors?
  @seo_locale_accessors ||= ActiveSeo.config.locale_accessors
end
seo_meta() click to toggle source
# File lib/active_seo/meta.rb, line 74
def seo_meta
  @seo_meta ||= ActiveSeo::SeoMeta.new(self).result
end
seo_setup(options={}) click to toggle source
# File lib/active_seo/meta.rb, line 45
def seo_setup(options={})
  self.seo_config = ActiveSeo::Config.new(options.reverse_merge(seo_config))
  define_seo_validations
end