Class: HammerCLI::Options::Validators::DSL::AnyConstraint
- Inherits:
-
BaseConstraint
- Object
- BaseConstraint
- HammerCLI::Options::Validators::DSL::AnyConstraint
- Defined in:
- lib/hammer_cli/options/validators/dsl.rb
Instance Attribute Summary
Attributes inherited from BaseConstraint
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(options, option_values, to_check) ⇒ AnyConstraint
constructor
A new instance of AnyConstraint.
Methods inherited from BaseConstraint
Constructor Details
#initialize(options, option_values, to_check) ⇒ AnyConstraint
Returns a new instance of AnyConstraint.
85 86 87 88 89 |
# File 'lib/hammer_cli/options/validators/dsl.rb', line 85 def initialize(, option_values, to_check) super @rejected_msg = _("You can't set any of options %s.") @required_msg = _("At least one of options %s is required.") end |
Instance Method Details
#exist? ⇒ Boolean
91 92 93 94 95 96 |
# File 'lib/hammer_cli/options/validators/dsl.rb', line 91 def exist? @to_check.each do |opt| return true if option_passed?(opt) end return @to_check.empty? end |