class Titleizer::Title
Public Class Methods
new(key, options, preferred_title, rootize = false)
click to toggle source
# File lib/titleizer/base.rb, line 24 def initialize(key, options, preferred_title, rootize = false) @key = key @options = options @preferred_title = preferred_title @rootize = rootize end
Public Instance Methods
to_s()
click to toggle source
# File lib/titleizer/base.rb, line 31 def to_s case mode when :preferred "#{@preferred_title} | #{t('application')}" when :root "#{t('description')} | #{t('application')}" when :default "#{t(@key)} | #{t('application')}" else t('application') end end
Private Instance Methods
mode()
click to toggle source
# File lib/titleizer/base.rb, line 46 def mode if @preferred_title :preferred elsif @rootize :root elsif set?(@key) :default end end
set?(key)
click to toggle source
# File lib/titleizer/base.rb, line 56 def set?(key) !t(key).empty? end
t(key)
click to toggle source
# File lib/titleizer/base.rb, line 60 def t(key) I18n.t("title.#{key}", @options) end