Exception: InputSanitizer::CollectionLengthError

Inherits:
ValidationError
  • Object
show all
Defined in:
lib/input_sanitizer/errors.rb

Instance Attribute Summary

Attributes inherited from ValidationError

#field, #value

Instance Method Summary collapse

Constructor Details

#initialize(value, min, max) ⇒ CollectionLengthError

Returns a new instance of CollectionLengthError.



100
101
102
103
104
105
106
107
108
# File 'lib/input_sanitizer/errors.rb', line 100

def initialize(value, min, max)
  if min && max
    super("must be of length between #{min} and #{max}, given: #{value}")
  elsif min
    super("must be of length greater than or equal to #{min}, given: #{value}")
  else
    super("must be of length less than or equal to #{max}, given: #{value}")
  end
end

Instance Method Details

#codeObject



96
97
98
# File 'lib/input_sanitizer/errors.rb', line 96

def code
  :invalid_length
end