Class: Seorel::Controller::Params
- Inherits:
-
Object
- Object
- Seorel::Controller::Params
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/seorel/controller/params.rb
Instance Method Summary collapse
- #base_description ⇒ Object
- #base_title ⇒ Object
- #default_options ⇒ Object
- #description ⇒ Object
- #image ⇒ Object
-
#initialize(controller) ⇒ Params
constructor
A new instance of Params.
- #lookup_append_description ⇒ Object
- #lookup_append_title ⇒ Object
- #lookup_description ⇒ Object
- #lookup_i18n(key, default = nil) ⇒ Object
- #lookup_prepend_description ⇒ Object
- #lookup_prepend_title ⇒ Object
- #lookup_title ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(controller) ⇒ Params
Returns a new instance of Params.
13 14 15 |
# File 'lib/seorel/controller/params.rb', line 13 def initialize(controller) @controller = controller end |
Instance Method Details
#base_description ⇒ Object
41 42 43 |
# File 'lib/seorel/controller/params.rb', line 41 def base_description (config.description || self.lookup_description).html_safe end |
#base_title ⇒ Object
37 38 39 |
# File 'lib/seorel/controller/params.rb', line 37 def base_title (config.title || self.lookup_title).html_safe end |
#default_options ⇒ Object
45 46 47 |
# File 'lib/seorel/controller/params.rb', line 45 def ::Seorel.config end |
#description ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/seorel/controller/params.rb', line 25 def description [ self.lookup_prepend_description, self.base_description, self.lookup_append_description ].compact.join.html_safe end |
#image ⇒ Object
33 34 35 |
# File 'lib/seorel/controller/params.rb', line 33 def image config.image || .default_image end |
#lookup_append_description ⇒ Object
73 74 75 |
# File 'lib/seorel/controller/params.rb', line 73 def lookup_append_description lookup_i18n :append_description, .default_append_description end |
#lookup_append_title ⇒ Object
61 62 63 |
# File 'lib/seorel/controller/params.rb', line 61 def lookup_append_title lookup_i18n :append_title, .default_append_title end |
#lookup_description ⇒ Object
69 70 71 |
# File 'lib/seorel/controller/params.rb', line 69 def lookup_description lookup_i18n :description, .default_description end |
#lookup_i18n(key, default = nil) ⇒ Object
49 50 51 |
# File 'lib/seorel/controller/params.rb', line 49 def lookup_i18n(key, default = nil) I18n.t i18n_path(key), default: (default || '') end |
#lookup_prepend_description ⇒ Object
65 66 67 |
# File 'lib/seorel/controller/params.rb', line 65 def lookup_prepend_description lookup_i18n :prepend_description, .default_prepend_description end |
#lookup_prepend_title ⇒ Object
53 54 55 |
# File 'lib/seorel/controller/params.rb', line 53 def lookup_prepend_title lookup_i18n :prepend_title, .default_prepend_title end |
#lookup_title ⇒ Object
57 58 59 |
# File 'lib/seorel/controller/params.rb', line 57 def lookup_title lookup_i18n :title, .default_title end |
#title ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/seorel/controller/params.rb', line 17 def title [ self.lookup_prepend_title, self.base_title, self.lookup_append_title ].compact.join.html_safe end |