Sha256: 09df644d85abc272ced736e7add3f58c47b5888bd1a047078195c26da8cefb8b
Contents?: true
Size: 832 Bytes
Versions: 10
Compression:
Stored size: 832 Bytes
Contents
class ImageOptim module OptionHelpers # Remove option from hash and run through block or return default def get_option!(options, name, default) value = default if options.has_key?(name) value = options.delete(name) value = yield(value) if block_given? end instance_variable_set("@#{name}", value) end # Ensure number is in range def 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 # Raise unless all options are deleted def assert_options_empty!(options) unless options.empty? raise "unknown options #{options.inspect} for #{self}" end end end end
Version data entries
10 entries across 10 versions & 1 rubygems