module MetaRailsHelpers::TitleHelper

Public Instance Methods

title(identifier: :title, separator: '|', brand: default_brand, reverse: false) click to toggle source

Produces html title element

# File lib/meta/rails/helpers/title_helper.rb, line 4
def title(identifier: :title,
          separator: '|',
          brand: default_brand,
          reverse: false)
  title = content_for(identifier)
  separator = '' unless title.present? && brand.present?
  if reverse == true
    content_tag :title, [brand, separator, title].reject(&:blank?).join(' ')
  else
    content_tag :title, [title, separator, brand].reject(&:blank?).join(' ')
  end
end

Private Instance Methods

default_brand() click to toggle source

Returns Rails application class name as default brand

# File lib/meta/rails/helpers/title_helper.rb, line 20
def default_brand
  Rails.application.class.module_parent_name
end