Sha256: 10ad8043e97d83d6da22e3fb8d5fa72580448afb681555bc32916c0d237dc879

Contents?: true

Size: 1.33 KB

Versions: 23

Compression:

Stored size: 1.33 KB

Contents

class Header
  def initialize
    after_initialize!
  end

  def logo_path
    @logo_path ||= config['assets']['header_logo']['path']
  end

  def small_logo_path
    @small_logo_path ||= config['assets']['header_logo']['small_path'] ||
                         config['assets']['header_logo']['path']
  end

  def logo_alt
    @logo_alt ||= config['assets']['header_logo']['alt']
  end

  def name
    @name ||= config['name']
  end

  def subtitle
    @subtitle ||= config['subtitle']
  end

  def hiring_link?
    hiring_display
  end

  def sign_up_path
    @sign_up_path ||= config['header']['links']['sign-up']['path']
  end

  def sign_up_text
    @sign_up_text ||= config['header']['links']['sign-up']['text']
  end

  private

  def after_initialize!
    raise 'You must provide a config/business_info.yml file in your documentation path.' unless File.exist?("#{Rails.configuration.docs_base_path}/config/business_info.yml")
  end

  def config
    @config ||= YAML.safe_load(
      File.open("#{Rails.configuration.docs_base_path}/config/business_info.yml")
    )
  end

  def hiring_display
    raise 'You must provide a true or false value for the hiring display parameter inside the header section of the config/business_info.yml file' unless config['header']['hiring'].try(:has_key?, 'display')

    config['header']['hiring']['display']
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
station-0.0.120 lib/nexmo_developer/app/presenters/header.rb
station-0.0.119 lib/nexmo_developer/app/presenters/header.rb
station-0.0.118 lib/nexmo_developer/app/presenters/header.rb
station-0.0.115 lib/nexmo_developer/app/presenters/header.rb
station-0.0.114 lib/nexmo_developer/app/presenters/header.rb
station-0.0.113 lib/nexmo_developer/app/presenters/header.rb
station-0.0.112 lib/nexmo_developer/app/presenters/header.rb
station-0.0.111 lib/nexmo_developer/app/presenters/header.rb
station-0.0.110 lib/nexmo_developer/app/presenters/header.rb
station-0.0.109 lib/nexmo_developer/app/presenters/header.rb
station-0.0.108 lib/nexmo_developer/app/presenters/header.rb
station-0.0.107 lib/nexmo_developer/app/presenters/header.rb
station-0.0.106 lib/nexmo_developer/app/presenters/header.rb
station-0.0.105 lib/nexmo_developer/app/presenters/header.rb
station-0.0.104 lib/nexmo_developer/app/presenters/header.rb
station-0.0.103 lib/nexmo_developer/app/presenters/header.rb
station-0.0.102 lib/nexmo_developer/app/presenters/header.rb
station-0.0.101 lib/nexmo_developer/app/presenters/header.rb
station-0.0.100 lib/nexmo_developer/app/presenters/header.rb
station-0.0.97 lib/nexmo_developer/app/presenters/header.rb