Class: Optimist::EitherConstraint

Inherits:
Constraint show all
Defined in:
lib/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 Optimist::Constraint

Instance Method Details

#error_condition(overlap_size) ⇒ Object



76
77
78
# File 'lib/optimist.rb', line 76

def error_condition(overlap_size)
  overlap_size != 1
end

#error_message(longargs) ⇒ Object



79
80
81
# File 'lib/optimist.rb', line 79

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