Class: Recheck::Optimist::Constraint
- Inherits:
-
Object
- Object
- Recheck::Optimist::Constraint
- Defined in:
- lib/recheck/vendor/optimist.rb
Overview
Abstract class for a constraint. Do not use by itself.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(syms) ⇒ Constraint
constructor
A new instance of Constraint.
- #validate(given_args:, specs:) ⇒ Object
Constructor Details
#initialize(syms) ⇒ Constraint
Returns a new instance of Constraint.
52 53 54 |
# File 'lib/recheck/vendor/optimist.rb', line 52 def initialize(syms) @idents = syms end |
Instance Method Details
#validate(given_args:, specs:) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/recheck/vendor/optimist.rb', line 56 def validate(given_args:, specs:) overlap = @idents & given_args.keys if error_condition(overlap.size) longargs = @idents.map { |sym| "--#{specs[sym].long.long}" } raise CommandlineError, (longargs) end end |