Module: PageTitleHelper::Interpolations
Overview
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.interpolate(pattern, *args) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/page_title_helper.rb', line 19 def self.interpolate(pattern, *args) instance_methods(false).sort.reverse.inject(pattern.to_s.dup) do |result, tag| result.gsub(/:#{tag}/) do |_match| send(tag, *args) end end end |
Instance Method Details
#app(env) ⇒ Object
27 28 29 |
# File 'lib/page_title_helper.rb', line 27 def app(env) env[:app] || I18n.t('app.name', default: File.basename(Rails.root).humanize) end |
#title(env) ⇒ Object
31 32 33 |
# File 'lib/page_title_helper.rb', line 31 def title(env) env[:title] end |