Class: Lutaml::Yaml::Adapter::YeptrisAdapter
- Inherits:
-
StandardAdapter
- Object
- KeyValue::Document
- Document
- StandardAdapter
- Lutaml::Yaml::Adapter::YeptrisAdapter
- Defined in:
- lib/lutaml/yaml/adapter/yeptris_adapter.rb
Overview
YAML over the yeptris engine (libyeptris C11). Uses the native Yeptris::YAML surface, which does not rebind or interact with the Psych constant, so it coexists with the standard adapter in one process. Inherits the document/generation contract; only the engine calls differ.
Semantic notes vs the standard adapter's Psych.safe_load: implicit typing is parity-verified (compat_11 schema); anchors and aliases always resolve; a tagged value without a core type materializes as plain data instead of raising DisallowedClass.
Constant Summary
Constants inherited from StandardAdapter
StandardAdapter::FORMAT_SYMBOL, StandardAdapter::PERMITTED_CLASSES, StandardAdapter::PERMITTED_CLASSES_BASE
Instance Attribute Summary
Attributes inherited from KeyValue::Document
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from KeyValue::Document
#[], #[]=, #initialize, #key?, #to_h
Constructor Details
This class inherits a constructor from Lutaml::KeyValue::Document
Class Method Details
.parse(yaml, _options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/lutaml/yaml/adapter/yeptris_adapter.rb', line 21 def self.parse(yaml, = {}) # rubocop:disable-next Naming/VariableNumber -- upstream schema literal Yeptris::YAML.load(yaml, schema: :compat_11) end |
Instance Method Details
#to_yaml(_options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lutaml/yaml/adapter/yeptris_adapter.rb', line 26 def to_yaml( = {}) attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element) # Unwrap __root__ wrapper to get actual content @attributes.to_hash["__root__"] else # Legacy Hash input (backward compatibility) @attributes end Yeptris::YAML.dump(attributes_to_serialize) end |