Sha256: 469863b1c3b20f6effd167dd1660934944b13fd98534513beb30630d436d46ee
Contents?: true
Size: 538 Bytes
Versions: 2
Compression:
Stored size: 538 Bytes
Contents
module BBLib class OptsParser class ElementOf < BasicOption attr_ary :options, aliases: :opts attr_of Proc, :comparitor, default: proc { |opt, val| opt == val } def valid?(value) return false unless options.any? { |opt| comparitor.call(opt, value) } return true if validators.empty? validators.all? do |validator| validator.call(value) end end protected def format_value(value) value.to_s end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bblib-2.0.5 | lib/bblib/cli/options/element_of.rb |
bblib-2.0.4 | lib/bblib/cli/options/element_of.rb |