Sha256: 7a0afdfc92d22a2dd74bd78101d8c163d79b64866bb441ae2856666c325677ea

Contents?: true

Size: 360 Bytes

Versions: 29

Compression:

Stored size: 360 Bytes

Contents

class ImageOptim
  # Helper methods for options
  module OptionHelpers
    # Ensure number is in range
    def self.limit_with_range(number, range)
      if range.include?(number)
        number
      elsif number < range.first
        range.first
      elsif range.exclude_end?
        range.last - 1
      else
        range.last
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
image_optim-0.26.3 lib/image_optim/option_helpers.rb
image_optim-0.26.2 lib/image_optim/option_helpers.rb
discourse_image_optim-0.26.2 lib/image_optim/option_helpers.rb
discourse_image_optim-0.26.1 lib/image_optim/option_helpers.rb
image_optim-0.26.1 lib/image_optim/option_helpers.rb
image_optim-0.26.0 lib/image_optim/option_helpers.rb
image_optim-0.25.0 lib/image_optim/option_helpers.rb
discourse_image_optim-0.24.5 lib/image_optim/option_helpers.rb
image_optim-0.24.3 lib/image_optim/option_helpers.rb
discourse_image_optim-0.24.4 lib/image_optim/option_helpers.rb
image_optim-0.24.2 lib/image_optim/option_helpers.rb
image_optim-0.24.1 lib/image_optim/option_helpers.rb
image_optim-0.24.0 lib/image_optim/option_helpers.rb
image_optim-0.23.0 lib/image_optim/option_helpers.rb
image_optim-0.22.1 lib/image_optim/option_helpers.rb
image_optim-0.22.0 lib/image_optim/option_helpers.rb
openstreetmap-image_optim-0.21.0.1 lib/image_optim/option_helpers.rb
image_optim-0.21.0 lib/image_optim/option_helpers.rb
image_optim-0.20.2 lib/image_optim/option_helpers.rb
image_optim-0.20.1 lib/image_optim/option_helpers.rb