class TitleNormalizer

Public Class Methods

call(folder) click to toggle source
# File lib/nexmo_developer/app/presenters/title_normalizer.rb, line 2
def self.call(folder)
  new(folder).normalize
end
new(folder) click to toggle source
# File lib/nexmo_developer/app/presenters/title_normalizer.rb, line 6
def initialize(folder)
  @folder = folder
end

Public Instance Methods

normalize() click to toggle source
# File lib/nexmo_developer/app/presenters/title_normalizer.rb, line 10
def normalize
  if @folder[:is_task?] || @folder[:is_tabbed?]
    @folder[:title]
  elsif @folder[:is_file?]
    frontmatter['navigation'] || frontmatter['title']
  else
    I18n.t("menu.#{@folder[:title]}")
  end
end

Private Instance Methods

frontmatter() click to toggle source
# File lib/nexmo_developer/app/presenters/title_normalizer.rb, line 22
def frontmatter
  @frontmatter ||= YAML.load_file(@folder[:path])
end