Module: PageTitleHelper::Interpolations
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.interpolate(pattern, *args) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/page_title_helper.rb', line 17 def self.interpolate(pattern, *args) instance_methods(false).sort.reverse.inject(pattern.dup) do |result, tag| result.gsub(/:#{tag}/) do |match| send(tag, *args) end end end |
Instance Method Details
#app(env) ⇒ Object
25 26 27 |
# File 'lib/page_title_helper.rb', line 25 def app(env) env.[:app] || I18n.translate(:'app.name', :default => File.basename(RAILS_ROOT).humanize) end |
#title(env) ⇒ Object
29 30 31 |
# File 'lib/page_title_helper.rb', line 29 def title(env) env.title end |