Class: Recheck::Optimist::EitherConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/recheck/vendor/optimist.rb

Overview

An Either-Or constraint. For Mutually exclusive options

Instance Method Summary collapse

Methods inherited from Constraint

#initialize, #validate

Constructor Details

This class inherits a constructor from Recheck::Optimist::Constraint

Instance Method Details

#error_condition(overlap_size) ⇒ Object



89
90
91
# File 'lib/recheck/vendor/optimist.rb', line 89

def error_condition(overlap_size)
  overlap_size != 1
end

#error_message(longargs) ⇒ Object



93
94
95
# File 'lib/recheck/vendor/optimist.rb', line 93

def error_message(longargs)
  "one and only one of #{longargs.join(", ")} is required"
end