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.



60
61
62
63
64
# File 'lib/hammer_cli/validator.rb', line 60

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)


66
67
68
69
70
71
# File 'lib/hammer_cli/validator.rb', line 66

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