Class: BBLib::OptsParser::ElementOf

Inherits:
BasicOption show all
Defined in:
lib/bblib/cli/options/element_of.rb

Instance Method Summary collapse

Methods inherited from BasicOption

#extract

Methods inherited from Option

#flag_match?, #multi_value?, #retrieve, #split, #to_s, types, #valid!

Methods included from TypeInit

included

Methods included from Effortless

#_attrs, included

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/bblib/cli/options/element_of.rb', line 8

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