Class: Head
- Inherits:
-
Object
- Object
- Head
- Defined in:
- lib/nexmo_developer/app/presenters/head.rb
Defined Under Namespace
Classes: Description
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#frontmatter ⇒ Object
readonly
Returns the value of attribute frontmatter.
Instance Method Summary collapse
- #apple_touch_icon ⇒ Object
- #application_name ⇒ Object
- #description ⇒ Object
- #favicon ⇒ Object
- #favicon_32_squared ⇒ Object
- #google_site_verification ⇒ Object
-
#initialize(frontmatter = nil) ⇒ Head
constructor
A new instance of Head.
- #manifest ⇒ Object
- #mstile_144_squared ⇒ Object
- #og_image ⇒ Object
- #og_image_height ⇒ Object
- #og_image_width ⇒ Object
- #safari_pinned_tab ⇒ Object
- #title ⇒ Object
- #title_from_frontmatter ⇒ Object
Constructor Details
#initialize(frontmatter = nil) ⇒ Head
Returns a new instance of Head.
21 22 23 24 25 26 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 21 def initialize(frontmatter = nil) @frontmatter = frontmatter after_initialize! validate_files_presence! end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
19 20 21 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 19 def config @config end |
#frontmatter ⇒ Object (readonly)
Returns the value of attribute frontmatter.
19 20 21 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 19 def frontmatter @frontmatter end |
Instance Method Details
#apple_touch_icon ⇒ Object
70 71 72 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 70 def apple_touch_icon 'meta/apple-touch-icon.png' end |
#application_name ⇒ Object
46 47 48 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 46 def application_name @application_name ||= config['application-name'] end |
#description ⇒ Object
38 39 40 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 38 def description @description ||= Description.new(config: config, frontmatter: frontmatter).description end |
#favicon ⇒ Object
50 51 52 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 50 def favicon 'meta/favicon.ico' end |
#favicon_32_squared ⇒ Object
54 55 56 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 54 def favicon_32_squared 'meta/favicon-32x32.png' end |
#google_site_verification ⇒ Object
42 43 44 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 42 def google_site_verification @google_site_verification ||= config['google-site-verification'] end |
#manifest ⇒ Object
58 59 60 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 58 def manifest 'meta/manifest.json' end |
#mstile_144_squared ⇒ Object
66 67 68 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 66 def mstile_144_squared 'meta/mstile-144x144.png' end |
#og_image ⇒ Object
74 75 76 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 74 def og_image @og_image ||= "meta/#{config['og-image']}" end |
#og_image_height ⇒ Object
82 83 84 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 82 def og_image_height @og_image_height ||= config['og-image-height'] end |
#og_image_width ⇒ Object
78 79 80 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 78 def og_image_width @og_image_width ||= config['og-image-width'] end |
#safari_pinned_tab ⇒ Object
62 63 64 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 62 def safari_pinned_tab 'meta/safari-pinned-tab.svg' end |
#title ⇒ Object
28 29 30 31 32 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 28 def title @title ||= title_from_frontmatter || config.fetch('title') do raise "You must provide a 'title' parameter in header_meta.yml" end end |
#title_from_frontmatter ⇒ Object
34 35 36 |
# File 'lib/nexmo_developer/app/presenters/head.rb', line 34 def title_from_frontmatter @frontmatter && (@frontmatter['meta_title'] || @frontmatter['title']) end |