Class: TitleHelper::PageTitle

Inherits:
Object
  • Object
show all
Defined in:
lib/pineapples/templates/app/helpers/title_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_path, action_name, context, opts) ⇒ PageTitle

Returns a new instance of PageTitle.



16
17
18
19
20
21
22
23
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 16

def initialize(controller_path, action_name, context, opts)
  @controller_path = controller_path
  @action_name = action_name
  @context = context
  @application_name = opts[:application_name] || humanized_application_name
  @include_application_name = opts[:include_application_name] || true
  @separator = opts[:separator] || ' – '
end

Instance Attribute Details

#action_nameObject (readonly)

Returns the value of attribute action_name.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def action_name
  @action_name
end

#application_nameObject (readonly)

Returns the value of attribute application_name.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def application_name
  @application_name
end

#contextObject (readonly)

Returns the value of attribute context.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def context
  @context
end

#controller_pathObject (readonly)

Returns the value of attribute controller_path.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def controller_path
  @controller_path
end

#include_application_nameObject (readonly)

Returns the value of attribute include_application_name.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def include_application_name
  @include_application_name
end

#separatorObject (readonly)

Returns the value of attribute separator.



13
14
15
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 13

def separator
  @separator
end

Instance Method Details

#to_sObject



25
26
27
28
29
30
31
# File 'lib/pineapples/templates/app/helpers/title_helper.rb', line 25

def to_s
  title = translate_action
  if include_application_name
    title << "#{separator}#{application_name}" if title != application_name
  end
  title
end