Sha256: 8ce8eec8c72daf73e74ccbe1ba69f4c8db2460dcc79c92246d4da27671609b4f

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

require 'imgix/version'
require 'imgix/client'
require 'imgix/path'

module Imgix
  # regex pattern used to determine if a domain is valid
  DOMAIN_REGEX = /^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i

  # returns an array of width values used during scrset generation
  TARGET_WIDTHS = lambda {
    increment_percentage = 8
    max_size = 8192
    resolutions = []
    prev = 100

    while(prev <= max_size)
      # ensures that each width is even
      resolutions.push((2 * (prev / 2).round))
      prev *= 1 + ((increment_percentage.to_f) / 100) * 2
    end

    resolutions.push(max_size)
    return resolutions
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imgix-3.1.1 lib/imgix.rb
imgix-3.1.0 lib/imgix.rb