Exception: InputSanitizer::ValueError
- Inherits:
-
ValidationError
- Object
- StandardError
- ValidationError
- InputSanitizer::ValueError
- Defined in:
- lib/input_sanitizer/errors.rb
Instance Attribute Summary
Attributes inherited from ValidationError
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(value, min, max) ⇒ ValueError
constructor
A new instance of ValueError.
Constructor Details
#initialize(value, min, max) ⇒ ValueError
Returns a new instance of ValueError.
116 117 118 119 120 121 122 123 124 |
# File 'lib/input_sanitizer/errors.rb', line 116 def initialize(value, min, max) if min && max super("must be between #{min} and #{max}, given: #{value}") elsif min super("must be higher than or equal to #{min}, given: #{value}") else super("must be lower than or equal to #{max}, given: #{value}") end end |
Instance Method Details
#code ⇒ Object
112 113 114 |
# File 'lib/input_sanitizer/errors.rb', line 112 def code :invalid_value end |