Class: HammerCLI::Options::Validators::DSL::AllConstraint

Inherits:
BaseConstraint
  • Object
show all
Defined in:
lib/hammer_cli/options/validators/dsl.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, option_values, to_check) ⇒ AllConstraint

Returns a new instance of AllConstraint.



58
59
60
61
62
# File 'lib/hammer_cli/options/validators/dsl.rb', line 58

def initialize(options, option_values, to_check)
  super
  @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)


64
65
66
67
68
69
# File 'lib/hammer_cli/options/validators/dsl.rb', line 64

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