Class: Optout::Validator::Multiple

Inherits:
Base
  • Object
show all
Defined in:
lib/optout.rb

Overview

Checks for multiple values

Instance Attribute Summary

Attributes inherited from Base

#setting

Instance Method Summary collapse

Instance Method Details

#validate!(opt) ⇒ Object



517
518
519
520
521
# File 'lib/optout.rb', line 517

def validate!(opt)
  if !opt.empty? && opt.value.respond_to?(:entries) && opt.value.entries.size > 1 && !multiple_values_allowed?
    raise OptionInvalid.new(opt.key, "multiple values are not allowed")
  end
end