Class: Lutaml::Xsd::Validation::Facets::MaxInclusiveFacetValidator
- Inherits:
-
FacetValidator
- Object
- FacetValidator
- Lutaml::Xsd::Validation::Facets::MaxInclusiveFacetValidator
- Defined in:
- lib/lutaml/xsd/validation/facets/max_inclusive_facet_validator.rb
Overview
Validates values against XSD maxInclusive facet
The maxInclusive facet specifies the maximum value (inclusive) for numeric types.
Instance Attribute Summary
Attributes inherited from FacetValidator
Instance Method Summary collapse
-
#error_message(value) ⇒ String
Generate error message for maximum inclusive violation.
-
#valid?(value) ⇒ Boolean
Validate value is <= maximum.
Methods inherited from FacetValidator
Constructor Details
This class inherits a constructor from Lutaml::Xsd::Validation::Facets::FacetValidator
Instance Method Details
#error_message(value) ⇒ String
Generate error message for maximum inclusive violation
43 44 45 |
# File 'lib/lutaml/xsd/validation/facets/max_inclusive_facet_validator.rb', line 43 def (value) "Value #{value} exceeds maximum inclusive value #{facet_value}" end |
#valid?(value) ⇒ Boolean
Validate value is <= maximum
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lutaml/xsd/validation/facets/max_inclusive_facet_validator.rb', line 28 def valid?(value) return false if value.nil? numeric_value = to_numeric(value) max_value = to_numeric(facet_value) return false unless numeric_value && max_value numeric_value <= max_value end |