Module: Spina::Conferences::PrimerTheme::AssetHelper

Defined in:
app/helpers/spina/conferences/primer_theme/asset_helper.rb

Overview

Helper for computing asset sources

Instance Method Summary collapse

Instance Method Details

#srcset(image, **options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/spina/conferences/primer_theme/asset_helper.rb', line 8

def srcset(image, **options)
  return if image.blank?

  options = options.symbolize_keys
  variant_options = options.delete(:variant)
  return if variant_options.blank?

  factors = options.delete(:factors) || DEFAULT_FACTORS
  variants_for image, variant_options: variant_options, factors: factors
end

#srcset_string(image, **options) ⇒ Object



19
20
21
22
# File 'app/helpers/spina/conferences/primer_theme/asset_helper.rb', line 19

def srcset_string(image, **options)
  srcset(image, **options).collect { |key, value| "#{key} #{value}" }
                          .join(', ')
end