Class: HammerCLI::Validator::AllConstraint

Inherits:
BaseConstraint show all
Defined in:
lib/hammer_cli/validator.rb

Direct Known Subclasses

OneOptionConstraint

Instance Attribute Summary

Attributes inherited from BaseConstraint

#rejected_msg, #required_msg

Instance Method Summary collapse

Methods inherited from BaseConstraint

#rejected, #required

Constructor Details

#initialize(options, to_check) ⇒ AllConstraint

Returns a new instance of AllConstraint.



70
71
72
73
74
# File 'lib/hammer_cli/validator.rb', line 70

def initialize(options, to_check)
  super(options, to_check)
  @rejected_msg = _("You can't set all options %s at one time")
  @required_msg = _("Options %s are required")
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


76
77
78
79
80
81
# File 'lib/hammer_cli/validator.rb', line 76

def exist?
  @to_check.each do |opt|
    return false unless option_passed?(opt)
  end
  return true
end