Class: Head::Description

Inherits:
Object
  • Object
show all
Defined in:
lib/nexmo_developer/app/presenters/head.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:, frontmatter:) ⇒ Description

Returns a new instance of Description.



3
4
5
6
# File 'lib/nexmo_developer/app/presenters/head.rb', line 3

def initialize(config:, frontmatter:)
  @config      = config
  @frontmatter = frontmatter
end

Instance Method Details

#descriptionObject



8
9
10
11
12
# File 'lib/nexmo_developer/app/presenters/head.rb', line 8

def description
  @description ||= from_frontmatter || @config.fetch('description') do
    raise "You must provide a 'description' parameter in header_meta.yml"
  end
end

#from_frontmatterObject



14
15
16
# File 'lib/nexmo_developer/app/presenters/head.rb', line 14

def from_frontmatter
  @frontmatter && (@frontmatter['meta_description'] || @frontmatter['description'])
end