Class: Flutie::PageTitlePresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/flutie/page_title_presenter.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name, content, separator, reversed = false) ⇒ PageTitlePresenter

Returns a new instance of PageTitlePresenter.



7
8
9
10
11
12
# File 'lib/flutie/page_title_presenter.rb', line 7

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

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



5
6
7
# File 'lib/flutie/page_title_presenter.rb', line 5

def app_name
  @app_name
end

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/flutie/page_title_presenter.rb', line 5

def content
  @content
end

#reversedObject (readonly)

Returns the value of attribute reversed.



5
6
7
# File 'lib/flutie/page_title_presenter.rb', line 5

def reversed
  @reversed
end

#separatorObject (readonly)

Returns the value of attribute separator.



5
6
7
# File 'lib/flutie/page_title_presenter.rb', line 5

def separator
  @separator
end

Instance Method Details

#ordered_partsObject



18
19
20
21
22
23
24
# File 'lib/flutie/page_title_presenter.rb', line 18

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

#to_sObject



14
15
16
# File 'lib/flutie/page_title_presenter.rb', line 14

def to_s
  ordered_parts.compact.join(separator)
end