Module: Cloudimage::Srcset

Included in:
URI
Defined in:
lib/cloudimage/srcset.rb

Constant Summary collapse

SRCSET_RANGE =

5760 is 3x 1920 (the largest common screen width): gs.statcounter.com/screen-resolution-stats

(100..5_760).freeze
SRCSET_GROWTH_FACTOR =
1.67

Instance Method Summary collapse

Instance Method Details

#to_srcset(**extra_params) ⇒ Object



10
11
12
13
14
# File 'lib/cloudimage/srcset.rb', line 10

def to_srcset(**extra_params)
  srcset_widths
    .map { |width| "#{to_url(**extra_params, w: width)} #{width}w" }
    .join(', ')
end