Class: Optimist::DependConstraint

Inherits:
Constraint show all
Defined in:
lib/optimist.rb

Overview

A Dependency constraint. Useful when Option A requires Option B also be used.

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



56
57
58
# File 'lib/optimist.rb', line 56

def error_condition(overlap_size)
  (overlap_size != 0) && (overlap_size != @idents.size)
end

#error_message(longargs) ⇒ Object



59
60
61
# File 'lib/optimist.rb', line 59

def error_message(longargs)
  "#{longargs.join(', ')} have a dependency and must be given together"
end