Sha256: 3c3f477409f67c9180888c2d7fc508c15b865e75f7ff141051e0735b773323fe
Contents?: true
Size: 572 Bytes
Versions: 12
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true 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
12 entries across 12 versions & 1 rubygems