Class: Cl::Opts::Validate::Requireds
Instance Attribute Summary
Attributes inherited from Validator
#cmd, #opts, #orig, #values
Instance Method Summary
collapse
Methods inherited from Validator
#compact, #invert, #only
Methods included from Regex
#format_regex
Instance Method Details
#apply ⇒ Object
41
42
43
|
# File 'lib/cl/opts/validate.rb', line 41
def apply
raise RequiredsOpts.new(missing) if missing.any?
end
|
#missing ⇒ Object
45
46
47
48
49
|
# File 'lib/cl/opts/validate.rb', line 45
def missing
@missing ||= cmd.class.required.map do |alts|
alts if alts.none? { |alt| Array(alt).all? { |key| values.key?(key) } }
end.compact
end
|