Sha256: 9127a5278a350402469a5f80bd671aaf2f0e564f28434e793dd6e66b2ea19e0e
Contents?: true
Size: 541 Bytes
Versions: 2
Compression:
Stored size: 541 Bytes
Contents
class ImageOptim # Denote ternary value (`true`/`false`/`nil`) for worker option class TrueFalseNil # Add handling of ternary value in OptionParser instance, maps `nil` and # `'nil'` to `nil` def self.add_to_option_parser(option_parser) completing = OptionParser.top.atype[TrueClass][0].merge('nil' => nil) option_parser.accept(self, completing){ |_arg, val| val } end # Convert everything truthy to `true`, leave `false` and `nil` as is def self.convert(value) value && true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
image_optim-0.26.3 | lib/image_optim/true_false_nil.rb |
image_optim-0.26.2 | lib/image_optim/true_false_nil.rb |