Class: Lutaml::Model::Configuration
- Inherits:
-
Object
- Object
- Lutaml::Model::Configuration
- Defined in:
- lib/lutaml/model/configuration.rb
Overview
Single source of truth for Lutaml::Model configuration.
Adapter methods delegate to AdapterResolver. This class retains the configure block API, register, and non-adapter settings.
Instance Attribute Summary collapse
-
#default_register ⇒ Object
(also: #default_context_id)
Returns the value of attribute default_register.
-
#xml_plan_fast_path ⇒ Object
Experimental: whole-document native materialization for plan- compilable XML models (Leptris::XML::Descriptor walk).
Instance Method Summary collapse
-
#adapter_for(format) ⇒ Object
Dynamic accessor for adapter types — delegates to AdapterResolver.
- #configure {|_self| ... } ⇒ Object
- #configured? ⇒ Boolean
-
#get_adapter(format) ⇒ Object
Get adapter class for a format.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mappings_class_for(format) ⇒ Object
-
#reset! ⇒ Object
Reset configuration to defaults.
-
#set_adapter(format, adapter_type) ⇒ Object
Dynamic setter for adapter types — delegates to AdapterResolver.
- #to_h ⇒ Object
- #transformer_for(format) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 |
# File 'lib/lutaml/model/configuration.rb', line 23 def initialize @default_register = :default @configured = false @xml_plan_fast_path = false end |
Instance Attribute Details
#default_register ⇒ Object Also known as: default_context_id
Returns the value of attribute default_register.
17 18 19 |
# File 'lib/lutaml/model/configuration.rb', line 17 def default_register @default_register end |
#xml_plan_fast_path ⇒ Object
Experimental: whole-document native materialization for plan- compilable XML models (Leptris::XML::Descriptor walk). Opt-in while the full semantics audit completes.
21 22 23 |
# File 'lib/lutaml/model/configuration.rb', line 21 def xml_plan_fast_path @xml_plan_fast_path end |
Instance Method Details
#adapter_for(format) ⇒ Object
Dynamic accessor for adapter types — delegates to AdapterResolver
40 41 42 |
# File 'lib/lutaml/model/configuration.rb', line 40 def adapter_for(format) AdapterResolver.configured_type(format) end |
#configure {|_self| ... } ⇒ Object
29 30 31 32 33 |
# File 'lib/lutaml/model/configuration.rb', line 29 def configure yield self if block_given? @configured = true self end |
#configured? ⇒ Boolean
35 36 37 |
# File 'lib/lutaml/model/configuration.rb', line 35 def configured? @configured end |
#get_adapter(format) ⇒ Object
Get adapter class for a format
50 51 52 |
# File 'lib/lutaml/model/configuration.rb', line 50 def get_adapter(format) AdapterResolver.adapter_for(format) end |
#mappings_class_for(format) ⇒ Object
83 84 85 |
# File 'lib/lutaml/model/configuration.rb', line 83 def mappings_class_for(format) Lutaml::Model::FormatRegistry.mappings_class_for(format) end |
#reset! ⇒ Object
Reset configuration to defaults
69 70 71 72 73 74 |
# File 'lib/lutaml/model/configuration.rb', line 69 def reset! @default_register = :default @configured = false AdapterResolver.reset! AdapterScope.reset! end |
#set_adapter(format, adapter_type) ⇒ Object
Dynamic setter for adapter types — delegates to AdapterResolver
45 46 47 |
# File 'lib/lutaml/model/configuration.rb', line 45 def set_adapter(format, adapter_type) AdapterResolver.set_adapter_type(format, adapter_type) end |
#to_h ⇒ Object
76 77 78 79 80 81 |
# File 'lib/lutaml/model/configuration.rb', line 76 def to_h { default_register: @default_register, configured: @configured, } end |
#transformer_for(format) ⇒ Object
87 88 89 |
# File 'lib/lutaml/model/configuration.rb', line 87 def transformer_for(format) Lutaml::Model::FormatRegistry.transformer_for(format) end |