Sha256: 32e999fbd8c588ce7cc1b3a9f4951f6348ec6fe1ef3102dc8a3e2185cdf22c62
Contents?: true
Size: 514 Bytes
Versions: 5
Compression:
Stored size: 514 Bytes
Contents
module BBLib class OptsParser class Bool < BasicOption TRUE_STATEMENTS = %w{true yes y t 1} FALSE_STATEMENTS = %w{false no n f 0} protected def format_value(value) tru = TRUE_STATEMENTS.any? { |ts| ts == value.downcase } fal = FALSE_STATEMENTS.any? { |fs| fs == value.downcase } raise InvalidArgumentException, "#{name} is a boolean argument but got a non-boolean value" unless tru || fal tru && !fal end end end end
Version data entries
5 entries across 5 versions & 1 rubygems