Class: Cl::Opts::Validate::Required
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
30
31
32
33
|
# File 'lib/cl/opts/validate.rb', line 30
def apply
raise RequiredOpts.new(missing.map(&:name)) if missing.any?
end
|
#missing ⇒ Object
35
36
37
|
# File 'lib/cl/opts/validate.rb', line 35
def missing
@missing ||= opts.select(&:required?).select { |opt| !values.key?(opt.name) }
end
|