Exception: InputSanitizer::CollectionLengthError
- Inherits:
-
ValidationError
- Object
- StandardError
- ValidationError
- InputSanitizer::CollectionLengthError
- Defined in:
- lib/input_sanitizer/errors.rb
Instance Attribute Summary
Attributes inherited from ValidationError
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(value, min, max) ⇒ CollectionLengthError
constructor
A new instance of CollectionLengthError.
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
#code ⇒ Object
96 97 98 |
# File 'lib/input_sanitizer/errors.rb', line 96 def code :invalid_length end |