Class: Head::Description
- Inherits:
-
Object
- Object
- Head::Description
- Defined in:
- lib/nexmo_developer/app/presenters/head.rb
Instance Method Summary collapse
- #description ⇒ Object
- #from_frontmatter ⇒ Object
-
#initialize(config:, frontmatter:) ⇒ Description
constructor
A new instance of Description.
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
#description ⇒ Object
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_frontmatter ⇒ Object
14 15 16 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 14 def from_frontmatter @frontmatter && (@frontmatter['meta_description'] || @frontmatter['description']) end |