class Seorel::Controller::Params
Attributes
controller[R]
Public Class Methods
new(controller = nil)
click to toggle source
# File lib/seorel/controller/params.rb, line 15 def initialize(controller = nil) @controller = controller end
Public Instance Methods
description()
click to toggle source
# File lib/seorel/controller/params.rb, line 34 def description [ lookup_prepend_description, base_description, page_text, lookup_append_description ].compact.join.html_safe end
image()
click to toggle source
# File lib/seorel/controller/params.rb, line 47 def image config.image || default_options.default_image end
keywords()
click to toggle source
# File lib/seorel/controller/params.rb, line 43 def keywords default_options.default_keywords end
open_graph_extras()
click to toggle source
# File lib/seorel/controller/params.rb, line 51 def open_graph_extras default_options.default_og_metas end
page_text()
click to toggle source
# File lib/seorel/controller/params.rb, line 19 def page_text return unless available_pagination? default_options.pagination_format.gsub('%page%', pagination_page) end
title()
click to toggle source
# File lib/seorel/controller/params.rb, line 25 def title [ lookup_prepend_title, base_title, page_text, lookup_append_title ].compact.join.html_safe end
twitter_extras()
click to toggle source
# File lib/seorel/controller/params.rb, line 55 def twitter_extras default_options.default_twitter_metas end
Protected Instance Methods
action_name()
click to toggle source
# File lib/seorel/controller/params.rb, line 122 def action_name controller ? controller.action_name : 'undefined' end
available_pagination?()
click to toggle source
# File lib/seorel/controller/params.rb, line 70 def available_pagination? default_options.enable_pagination && pagination_page end
base_description()
click to toggle source
# File lib/seorel/controller/params.rb, line 78 def base_description (config.description || lookup_description).html_safe end
base_title()
click to toggle source
# File lib/seorel/controller/params.rb, line 74 def base_title (config.title || lookup_title).html_safe end
controller_name()
click to toggle source
# File lib/seorel/controller/params.rb, line 114 def controller_name if controller controller.class.name.underscore.gsub(/_controller$/, '') else 'undefined' end end
default_options()
click to toggle source
# File lib/seorel/controller/params.rb, line 82 def default_options ::Seorel.config end
i18n_path(key)
click to toggle source
# File lib/seorel/controller/params.rb, line 126 def i18n_path(key) ['seorel', controller_name, action_name, key].join('.') end
lookup_append_description()
click to toggle source
# File lib/seorel/controller/params.rb, line 110 def lookup_append_description lookup_i18n :append_description, default_options.default_append_description end
lookup_append_title()
click to toggle source
# File lib/seorel/controller/params.rb, line 98 def lookup_append_title lookup_i18n :append_title, default_options.default_append_title end
lookup_description()
click to toggle source
# File lib/seorel/controller/params.rb, line 106 def lookup_description lookup_i18n :description, default_options.default_description end
lookup_i18n(key, default = nil)
click to toggle source
# File lib/seorel/controller/params.rb, line 86 def lookup_i18n(key, default = nil) I18n.t i18n_path(key), default: (default || '') end
lookup_prepend_description()
click to toggle source
# File lib/seorel/controller/params.rb, line 102 def lookup_prepend_description lookup_i18n :prepend_description, default_options.default_prepend_description end
lookup_prepend_title()
click to toggle source
# File lib/seorel/controller/params.rb, line 90 def lookup_prepend_title lookup_i18n :prepend_title, default_options.default_prepend_title end
lookup_title()
click to toggle source
# File lib/seorel/controller/params.rb, line 94 def lookup_title lookup_i18n :title, default_options.default_title end
pagination_page()
click to toggle source
# File lib/seorel/controller/params.rb, line 65 def pagination_page return unless controller params.try(:[], default_options.pagination_parameter_name.to_s) end