Class: Cl::Opts::Validate::Format
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
70
71
72
|
# File 'lib/cl/opts/validate.rb', line 70
def apply
raise InvalidFormat.new(invalid) if invalid.any?
end
|
#invalid ⇒ Object
74
75
76
77
78
79
|
# File 'lib/cl/opts/validate.rb', line 74
def invalid
@invalid ||= opts.select(&:format?).map do |opt|
value = values[opt.name]
[opt.name, opt.format] if value && !opt.formatted?(value)
end.compact
end
|