Class: Lutaml::Model::Schema::Renderers::RestrictedType
- Defined in:
- lib/lutaml/model/schema/renderers/restricted_type.rb
Overview
Renders a Definitions::RestrictedType into a Ruby class extending a Lutaml::Model::Type::* with Layer-2 facet macros (lazy validation
.facetsround-trip) and a cast body that mutates options with the eager numeric facet values and delegates to super.
Constant Summary collapse
- INTEGER_BASES =
XSD base types whose bounds/enumeration values are integer literals.
i[ integer int long short byte positiveInteger nonNegativeInteger negativeInteger nonPositiveInteger unsignedLong unsignedInt unsignedShort unsignedByte ].freeze
- CAST_BASES =
Base types whose facet values must be emitted as a
castcall on the Lutaml type, so the generated literal equals the cast attribute value it is compared against (temporal/boolean/float parse specially). Keyed on both the XSD spelling (dateTime, from the XSD compiler) and the snake_case spelling (date_time, from the RNG compiler) since both feed this shared renderer. { boolean: "Lutaml::Model::Type::Boolean", float: "Lutaml::Model::Type::Float", double: "Lutaml::Model::Type::Float", date: "Lutaml::Model::Type::Date", dateTime: "Lutaml::Model::Type::DateTime", date_time: "Lutaml::Model::Type::DateTime", time: "Lutaml::Model::Type::Time", }.freeze
- EAGER_NUMERIC_BASES =
Bases whose bounds render as bare numeric literals, so the eager
options[:min]/[:max]path is valid Ruby. Every other base (temporal, boolean, string, or a user-defined type) carries a bound that is not a bare literal, so it stays macro-only and the eager path is skipped — the Layer-2 facet macros enforce it lazily. (INTEGER_BASES + i[decimal float double]).freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Lutaml::Model::Schema::Renderers::Base
Instance Method Details
#render ⇒ Object
44 45 46 |
# File 'lib/lutaml/model/schema/renderers/restricted_type.rb', line 44 def render Templates::RESTRICTED_SIMPLE_TYPE.result(binding) end |