Class: Optout::Validator::Array

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

Instance Attribute Summary

Attributes inherited from Base

#setting

Instance Method Summary collapse

Instance Method Details

#validate!(opt) ⇒ Object



543
544
545
546
547
548
549
550
551
552
# File 'lib/optout.rb', line 543

def validate!(opt)
  return if opt.empty?

  values = [opt.value].flatten
  values.each do |e|
    if !setting.include?(e)
      raise OptionInvalid.new(opt.key, "value '#{e}' must be one of (#{setting.join(", ")})")
    end
  end
end