Class: Lutaml::Xsd::Validation::Facets::MaxExclusiveFacetValidator
- Inherits:
-
FacetValidator
- Object
- FacetValidator
- Lutaml::Xsd::Validation::Facets::MaxExclusiveFacetValidator
- Defined in:
- lib/lutaml/xsd/validation/facets/max_exclusive_facet_validator.rb
Overview
Validates values against XSD maxExclusive facet
The maxExclusive facet specifies the maximum value (exclusive) for numeric types.
Instance Attribute Summary
Attributes inherited from FacetValidator
Instance Method Summary collapse
-
#error_message(value) ⇒ String
Generate error message for maximum exclusive 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 exclusive violation
43 44 45 46 |
# File 'lib/lutaml/xsd/validation/facets/max_exclusive_facet_validator.rb', line 43 def (value) "Value #{value} is not less than maximum exclusive 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_exclusive_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 |