Class: HammerCLI::Validator::OneOptionConstraint

Inherits:
AllConstraint show all
Defined in:
lib/hammer_cli/validator.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, to_check) ⇒ OneOptionConstraint

Returns a new instance of OneOptionConstraint.



85
86
87
88
89
# File 'lib/hammer_cli/validator.rb', line 85

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

Instance Method Details

#valueObject



91
92
93
# File 'lib/hammer_cli/validator.rb', line 91

def value
  get_option_value(@to_check[0])
end