Class: Uniword::Configuration
- Inherits:
-
Object
- Object
- Uniword::Configuration
- Defined in:
- lib/uniword/configuration.rb,
lib/uniword/configuration/configuration_loader.rb
Overview
Global runtime configuration for Uniword.
Holds save-path policy as plain, explicitly typed attributes. This object is runtime policy only: it has no file-loading behavior (see ConfigurationLoader for external YAML config files) and no serialization behavior.
This class also serves as the namespace for configuration-related classes (ConfigurationLoader, ConfigurationError).
Defined Under Namespace
Classes: ConfigurationError, ConfigurationLoader
Constant Summary collapse
- ON_NONCOMPLIANT_MODES =
Accepted values for
on_noncompliant_content.:strip— Word-identical default: non-compliant parts are dropped at load and recorded onPackage#stripped_parts.:raise— strict: parts are preserved; the save-timePackageIntegrityCheckerraisesUniword::ValidationErrorwith structured OPC-005 issues. %i[strip raise].freeze
Instance Attribute Summary collapse
-
#log_save_fixes ⇒ Boolean
Whether automatic fixes applied during save are logged.
-
#on_noncompliant_content ⇒ Symbol
Load-time policy for non-compliant parts (no content type declaration, OS artifact, ...).
-
#validate_on_save ⇒ Boolean
Whether documents are validated when saved.
-
#xsd_validation ⇒ Boolean
Whether XSD schema validation runs on save (slower, stricter).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Create a configuration with default policy values.
-
#reset! ⇒ Configuration
Restore all attributes to their default values.
Constructor Details
#initialize ⇒ Configuration
Create a configuration with default policy values.
Defaults: validate_on_save: true, xsd_validation: false, log_save_fixes: true, on_noncompliant_content: :strip.
59 60 61 |
# File 'lib/uniword/configuration.rb', line 59 def initialize reset! end |
Instance Attribute Details
#log_save_fixes ⇒ Boolean
Whether automatic fixes applied during save are logged.
47 48 49 |
# File 'lib/uniword/configuration.rb', line 47 def log_save_fixes @log_save_fixes end |
#on_noncompliant_content ⇒ Symbol
Load-time policy for non-compliant parts (no content type declaration, OS artifact, ...).
53 54 55 |
# File 'lib/uniword/configuration.rb', line 53 def on_noncompliant_content @on_noncompliant_content end |
#validate_on_save ⇒ Boolean
Whether documents are validated when saved.
37 38 39 |
# File 'lib/uniword/configuration.rb', line 37 def validate_on_save @validate_on_save end |
#xsd_validation ⇒ Boolean
Whether XSD schema validation runs on save (slower, stricter).
42 43 44 |
# File 'lib/uniword/configuration.rb', line 42 def xsd_validation @xsd_validation end |
Instance Method Details
#reset! ⇒ Configuration
Restore all attributes to their default values.
66 67 68 69 70 71 72 |
# File 'lib/uniword/configuration.rb', line 66 def reset! @validate_on_save = true @xsd_validation = false @log_save_fixes = true @on_noncompliant_content = :strip self end |