Class: HammerCLI::Options::Validators::DSL::AnyConstraint

Inherits:
BaseConstraint
  • Object
show all
Defined in:
lib/hammer_cli/options/validators/dsl.rb

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, 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(options, 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

Returns:

  • (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