Sha256: ab593978152a7754ceb22975910c7d517ffaddaa2f654700d59f857a705592b4

Contents?: true

Size: 460 Bytes

Versions: 94

Compression:

Stored size: 460 Bytes

Contents

class TitleNormalizer
  def self.call(folder)
    new(folder).normalize
  end

  def initialize(folder)
    @folder = folder
  end

  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

  def frontmatter
    @frontmatter ||= YAML.load_file(@folder[:path])
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
station-0.5.16 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.15 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.14 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.13 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.12 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.11 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.10 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.9 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.8 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.7 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.6 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.5 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.4 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.3 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.2 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.1 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.5.0 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.4.9 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.4.8 lib/nexmo_developer/app/presenters/title_normalizer.rb
station-0.4.7 lib/nexmo_developer/app/presenters/title_normalizer.rb