Class: Rbdantic::Validators::Types::Number
- Defined in:
- lib/rbdantic/validators/types/number.rb
Overview
Abstract base for numeric validators (Integer, Float)
Constant Summary collapse
- FLOAT_TOLERANCE_FACTOR =
Tolerance constants for floating-point comparison
1e-9- MIN_FLOAT_TOLERANCE =
1e-12
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #expected_type_name ⇒ Object
- #matches_type? ⇒ Boolean
- #validate_constraints(value, errors, location, strict: false) ⇒ Object
Methods inherited from Base
#coerce, #initialize, #validate
Constructor Details
This class inherits a constructor from Rbdantic::Validators::Types::Base
Instance Method Details
#expected_type_name ⇒ Object
16 17 18 |
# File 'lib/rbdantic/validators/types/number.rb', line 16 def expected_type_name raise NotImplementedError end |
#matches_type? ⇒ Boolean
12 13 14 |
# File 'lib/rbdantic/validators/types/number.rb', line 12 def matches_type? raise NotImplementedError end |
#validate_constraints(value, errors, location, strict: false) ⇒ Object
20 21 22 23 24 |
# File 'lib/rbdantic/validators/types/number.rb', line 20 def validate_constraints(value, errors, location, strict: false) validate_bounds(value, errors, location) validate_multiple_of(value, errors, location) if constraints[:multiple_of] value end |