# File lib/hammer_cli/validator.rb, line 114 def initialize(options, to_check) raise 'Set at least one expected option' if to_check.empty? super(options, to_check) end
# File lib/hammer_cli/validator.rb, line 134 def exist? return count_present_options == 1 end
# File lib/hammer_cli/validator.rb, line 119 def rejected raise NotImplementedError, '#rejected is unsupported for OneOfConstraint' end
# File lib/hammer_cli/validator.rb, line 123 def required_msg case count_present_options when 0 _("One of options %s is required.") when 1 '' else _("Only one of options %s can be set.") end end
# File lib/hammer_cli/validator.rb, line 139 def count_present_options @to_check.count do |opt| option_passed?(opt) end end