Module: ImageOptim::OptionHelpers
- Included in:
- Config
- Defined in:
- lib/image_optim/option_helpers.rb
Overview
Helper methods for options
Class Method Summary collapse
-
.limit_with_range(number, range) ⇒ Object
Ensure number is in range.
Class Method Details
.limit_with_range(number, range) ⇒ Object
Ensure number is in range
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/image_optim/option_helpers.rb', line 7 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 |