Sha256: 077a199dbd29d507acd95e47cf37a3b9fc561f25f7e16cb439515b46a558e0a6

Contents?: true

Size: 372 Bytes

Versions: 12

Compression:

Stored size: 372 Bytes

Contents

require 'image_optim/configuration_error'

class ImageOptim
  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

12 entries across 12 versions & 1 rubygems

Version Path
image_optim-0.13.3 lib/image_optim/option_helpers.rb
image_optim-0.13.2 lib/image_optim/option_helpers.rb
image_optim-0.13.1 lib/image_optim/option_helpers.rb
image_optim-0.13.0 lib/image_optim/option_helpers.rb
image_optim-0.12.1 lib/image_optim/option_helpers.rb
image_optim-0.12.0 lib/image_optim/option_helpers.rb
image_optim-0.11.2 lib/image_optim/option_helpers.rb
image_optim-0.11.1 lib/image_optim/option_helpers.rb
image_optim-0.11.0 lib/image_optim/option_helpers.rb
image_optim-0.10.2 lib/image_optim/option_helpers.rb
image_optim-0.10.1 lib/image_optim/option_helpers.rb
image_optim-0.10.0 lib/image_optim/option_helpers.rb