Module: Interage::FaviconHelper
- Included in:
- ApplicationHelper
- Defined in:
- lib/interage/favicon_helper.rb
Constant Summary collapse
- EXTENTION =
ENV.fetch('FAVICON_EXTENTION', 'png')
- FILE_NAME =
ENV.fetch('FAVICON_FILE_NAME', 'icons/apple-touch-icon')
- FAVICON_SIZES =
[nil, 57, 72, 76, 114, 120, 144, 152, 180].freeze
Instance Method Summary collapse
- #favicon_link_tags ⇒ Object
- #favicon_options(size) ⇒ Object
- #favicon_size_link_tags ⇒ Object
- #handler_name(size) ⇒ Object
- #handler_size(size, prefix = '') ⇒ Object
Instance Method Details
#favicon_link_tags ⇒ Object
9 10 11 |
# File 'lib/interage/favicon_helper.rb', line 9 def safe_join .push(favicon_link_tag) end |
#favicon_options(size) ⇒ Object
23 24 25 |
# File 'lib/interage/favicon_helper.rb', line 23 def (size) { type: 'image/png', rel: 'apple-touch-icon', sizes: handler_size(size) } end |
#favicon_size_link_tags ⇒ Object
13 14 15 16 17 |
# File 'lib/interage/favicon_helper.rb', line 13 def FAVICON_SIZES.map do |s| favicon_link_tag(handler_name(s), (s)) end end |
#handler_name(size) ⇒ Object
19 20 21 |
# File 'lib/interage/favicon_helper.rb', line 19 def handler_name(size) "#{FILE_NAME}#{handler_size(size, '-')}.#{EXTENTION}" end |
#handler_size(size, prefix = '') ⇒ Object
27 28 29 |
# File 'lib/interage/favicon_helper.rb', line 27 def handler_size(size, prefix = '') "#{prefix}#{size}x#{size}" if size.present? end |