Class: HammerCLI::Options::Validators::DSL::OneOptionConstraint

Inherits:
AllConstraint 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 AllConstraint

#exist?

Methods inherited from BaseConstraint

#exist?, #rejected, #required

Constructor Details

#initialize(options, option_values, to_check) ⇒ OneOptionConstraint

Returns a new instance of OneOptionConstraint.



73
74
75
76
77
# File 'lib/hammer_cli/options/validators/dsl.rb', line 73

def initialize(options, option_values, to_check)
  super(options, option_values, [to_check])
  @rejected_msg = _("You can't set option %s.")
  @required_msg = _("Option %s is required.")
end

Instance Method Details

#valueObject



79
80
81
# File 'lib/hammer_cli/options/validators/dsl.rb', line 79

def value
  get_option_value(@to_check[0])
end