Sha256: 88a673587fb35df5035e17955818eaef12ed1babbc34b50451dcd6f327b95075

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

# :nodoc:
module Flutie
  # :nodoc:
  class PageTitle
    DEFAULT_PAGE_TITLE_SYMBOL = :page_title
    DEFAULT_SEPARATOR = ' : '.freeze

    attr_reader :options

    def initialize(options)
      @options = options
    end

    def app_name
      options[:app_name] || rails_app_name
    end

    def page_title_symbol
      options[:page_title_symbol] || DEFAULT_PAGE_TITLE_SYMBOL
    end

    def separator
      options[:separator] || DEFAULT_SEPARATOR
    end

    private

    def rails_app_name
      Rails.application.class.to_s.split('::').first
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flutie-2.2.0 lib/flutie/page_title.rb
flutie-2.1.0 lib/flutie/page_title.rb