Sha256: ebf87bf700aabf8d423b3c23afbae52c03f1bda11c44fee8b9c1eee0fd4da3d1

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 Bytes

Contents

# :nodoc:
module Flutie
  # :nodoc:
  class PageTitlePresenter
    attr_reader :app_name, :content, :separator, :reversed

    def initialize(app_name, content, separator, reversed = false)
      @app_name = app_name
      @content = content
      @separator = separator
      @reversed = reversed
    end

    def to_s
      ordered_parts.compact.join(separator)
    end

    def ordered_parts
      if reversed_order?
        [content, app_name]
      else
        [app_name, content]
      end
    end

    private

    def reversed_order?
      @reversed
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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