Module: Lutaml::Model

Defined in:
lib/lutaml/model.rb,
lib/lutaml/model/cli.rb,
lib/lutaml/model/hash.rb,
lib/lutaml/model/json.rb,
lib/lutaml/model/toml.rb,
lib/lutaml/model/type.rb,
lib/lutaml/model/yaml.rb,
lib/lutaml/model/error.rb,
lib/lutaml/model/jsonl.rb,
lib/lutaml/model/store.rb,
lib/lutaml/model/utils.rb,
lib/lutaml/model/yamls.rb,
lib/lutaml/model/choice.rb,
lib/lutaml/model/config.rb,
lib/lutaml/model/errors.rb,
lib/lutaml/model/liquid.rb,
lib/lutaml/model/schema.rb,
lib/lutaml/model/version.rb,
lib/lutaml/model/register.rb,
lib/lutaml/model/sequence.rb,
lib/lutaml/model/services.rb,
lib/lutaml/model/type/uri.rb,
lib/lutaml/model/attribute.rb,
lib/lutaml/model/constants.rb,
lib/lutaml/model/serialize.rb,
lib/lutaml/model/transform.rb,
lib/lutaml/model/type/date.rb,
lib/lutaml/model/type/hash.rb,
lib/lutaml/model/type/time.rb,
lib/lutaml/model/collection.rb,
lib/lutaml/model/comparison.rb,
lib/lutaml/model/error/type.rb,
lib/lutaml/model/type/float.rb,
lib/lutaml/model/type/qname.rb,
lib/lutaml/model/type/value.rb,
lib/lutaml/model/validation.rb,
lib/lutaml/model/liquefiable.rb,
lib/lutaml/model/registrable.rb,
lib/lutaml/model/type/string.rb,
lib/lutaml/model/type/symbol.rb,
lib/lutaml/model/json_adapter.rb,
lib/lutaml/model/mapping_hash.rb,
lib/lutaml/model/organization.rb,
lib/lutaml/model/serializable.rb,
lib/lutaml/model/type/boolean.rb,
lib/lutaml/model/type/decimal.rb,
lib/lutaml/model/type/integer.rb,
lib/lutaml/model/type_context.rb,
lib/lutaml/model/compiled_rule.rb,
lib/lutaml/model/configuration.rb,
lib/lutaml/model/render_policy.rb,
lib/lutaml/model/services/base.rb,
lib/lutaml/model/services/type.rb,
lib/lutaml/model/type/duration.rb,
lib/lutaml/model/type_registry.rb,
lib/lutaml/model/type_resolver.rb,
lib/lutaml/model/comparable_nil.rb,
lib/lutaml/model/global_context.rb,
lib/lutaml/model/liquid/mapping.rb,
lib/lutaml/model/schema/helpers.rb,
lib/lutaml/model/transformation.rb,
lib/lutaml/model/type/date_time.rb,
lib/lutaml/model/type/reference.rb,
lib/tasks/performance_benchmark.rb,
lib/lutaml/model/format_registry.rb,
lib/lutaml/model/global_register.rb,
lib/lutaml/model/import_registry.rb,
lib/lutaml/model/instrumentation.rb,
lib/lutaml/model/mapping/mapping.rb,
lib/lutaml/model/one_entry_cache.rb,
lib/lutaml/model/schema/renderer.rb,
lib/lutaml/model/services/logger.rb,
lib/lutaml/model/type/hex_binary.rb,
lib/lutaml/model/comparable_model.rb,
lib/lutaml/model/context_registry.rb,
lib/lutaml/model/error/type_error.rb,
lib/lutaml/model/mapping/listener.rb,
lib/lutaml/model/schema/generator.rb,
lib/lutaml/model/consolidation_map.rb,
lib/lutaml/model/model_transformer.rb,
lib/lutaml/model/schema/decorators.rb,
lib/lutaml/model/serialize/builder.rb,
lib/lutaml/model/type_substitution.rb,
lib/lutaml/model/value_transformer.rb,
lib/lutaml/model/collection_handler.rb,
lib/lutaml/model/consolidation_rule.rb,
lib/lutaml/model/finalization_cache.rb,
lib/lutaml/model/schema/base_schema.rb,
lib/lutaml/model/schema/json_schema.rb,
lib/lutaml/model/schema/yaml_schema.rb,
lib/lutaml/model/services/validator.rb,
lib/lutaml/model/type/base64_binary.rb,
lib/lutaml/model/attribute_validator.rb,
lib/lutaml/model/schema/xml_compiler.rb,
lib/lutaml/model/uninitialized_class.rb,
lib/lutaml/model/cached_type_resolver.rb,
lib/lutaml/model/consolidation/engine.rb,
lib/lutaml/model/mapping/mapping_rule.rb,
lib/lutaml/model/schema/generator/ref.rb,
lib/lutaml/model/services/transformer.rb,
lib/lutaml/model/mapping/model_mapping.rb,
lib/lutaml/model/runtime_compatibility.rb,
lib/lutaml/model/schema/shared_methods.rb,
lib/lutaml/model/serialization_adapter.rb,
lib/lutaml/model/error/validation_error.rb,
lib/lutaml/model/serialize/model_import.rb,
lib/lutaml/model/transformation_builder.rb,
lib/lutaml/model/type/time_without_date.rb,
lib/lutaml/model/error/polymorphic_error.rb,
lib/lutaml/model/serialize/enum_handling.rb,
lib/lutaml/model/serialize/value_mapping.rb,
lib/lutaml/model/services/type/validator.rb,
lib/lutaml/model/transformation_registry.rb,
lib/lutaml/model/consolidation/dispatcher.rb,
lib/lutaml/model/error/unknown_type_error.rb,
lib/lutaml/model/serialize/initialization.rb,
lib/lutaml/model/error/invalid_value_error.rb,
lib/lutaml/model/schema/decorators/choices.rb,
lib/lutaml/model/schema/generator/property.rb,
lib/lutaml/model/schema/json_schema_parser.rb,
lib/lutaml/model/schema/schema_builder/oga.rb,
lib/lutaml/model/schema/xml_compiler/group.rb,
lib/lutaml/model/error/invalid_format_error.rb,
lib/lutaml/model/error/type/max_bound_error.rb,
lib/lutaml/model/error/type/min_bound_error.rb,
lib/lutaml/model/mapping/model_mapping_rule.rb,
lib/lutaml/model/register/namespace_binding.rb,
lib/lutaml/model/schema/xml_compiler/choice.rb,
lib/lutaml/model/error/no_root_mapping_error.rb,
lib/lutaml/model/error/type/max_length_error.rb,
lib/lutaml/model/error/type/min_length_error.rb,
lib/lutaml/model/schema/decorators/attribute.rb,
lib/lutaml/model/schema/generator/definition.rb,
lib/lutaml/model/schema/xml_compiler/element.rb,
lib/lutaml/model/serialize/format_conversion.rb,
lib/lutaml/model/error/no_mapping_found_error.rb,
lib/lutaml/model/error/type_not_enabled_error.rb,
lib/lutaml/model/register/model_tree_importer.rb,
lib/lutaml/model/schema/xml_compiler/sequence.rb,
lib/lutaml/model/consolidation/pattern_chunker.rb,
lib/lutaml/model/error/multiple_mappings_error.rb,
lib/lutaml/model/error/no_root_namespace_error.rb,
lib/lutaml/model/error/unresolvable_type_error.rb,
lib/lutaml/model/error/validation_failed_error.rb,
lib/lutaml/model/schema/xml_compiler/attribute.rb,
lib/lutaml/model/services/rule_value_extractor.rb,
lib/lutaml/model/consolidation_rule/gather_rule.rb,
lib/lutaml/model/error/choice_lower_bound_error.rb,
lib/lutaml/model/error/choice_upper_bound_error.rb,
lib/lutaml/model/error/incorrect_sequence_error.rb,
lib/lutaml/model/error/liquid_not_enabled_error.rb,
lib/lutaml/model/error/type/invalid_value_error.rb,
lib/lutaml/model/schema/helpers/template_helper.rb,
lib/lutaml/model/schema/schema_builder/nokogiri.rb,
lib/lutaml/model/serialize/attribute_definition.rb,
lib/lutaml/model/services/type/validator/number.rb,
lib/lutaml/model/services/type/validator/string.rb,
lib/lutaml/model/services/type/validator/symbol.rb,
lib/lutaml/model/type/uninitialized_class_guard.rb,
lib/lutaml/model/consolidation/attribute_grouper.rb,
lib/lutaml/model/error/pattern_not_matched_error.rb,
lib/lutaml/model/error/undefined_attribute_error.rb,
lib/lutaml/model/schema/xml_compiler/restriction.rb,
lib/lutaml/model/schema/xml_compiler/simple_type.rb,
lib/lutaml/model/services/default_value_resolver.rb,
lib/lutaml/model/error/invalid_choice_range_error.rb,
lib/lutaml/model/error/unknown_adapter_type_error.rb,
lib/lutaml/model/schema/xml_compiler/complex_type.rb,
lib/lutaml/model/serialize/transformation_builder.rb,
lib/lutaml/model/consolidation_rule/dispatch_block.rb,
lib/lutaml/model/error/import_model_with_root_error.rb,
lib/lutaml/model/error/invalid_attribute_name_error.rb,
lib/lutaml/model/error/invalid_attribute_type_error.rb,
lib/lutaml/model/error/liquid_class_not_found_error.rb,
lib/lutaml/model/error/mapping_already_exists_error.rb,
lib/lutaml/model/error/mapping_attribute_type_error.rb,
lib/lutaml/model/schema/decorators/class_definition.rb,
lib/lutaml/model/schema/xml_compiler/simple_content.rb,
lib/lutaml/model/error/collection_true_missing_error.rb,
lib/lutaml/model/schema/xml_compiler/attribute_group.rb,
lib/lutaml/model/schema/xml_compiler/complex_content.rb,
lib/lutaml/model/error/mixed_content_collection_error.rb,
lib/lutaml/model/error/type/pattern_not_matched_error.rb,
lib/lutaml/model/error/unknown_sequence_mapping_error.rb,
lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb,
lib/lutaml/model/error/invalid_attribute_options_error.rb,
lib/lutaml/model/error/mapping_attribute_missing_error.rb,
lib/lutaml/model/error/element_count_out_of_range_error.rb,
lib/lutaml/model/error/incorrect_mapping_argument_error.rb,
lib/lutaml/model/error/required_attribute_missing_error.rb,
lib/lutaml/model/schema/generator/properties_collection.rb,
lib/lutaml/model/schema/xml_compiler/registry_generator.rb,
lib/lutaml/model/consolidation_rule/pattern_content_rule.rb,
lib/lutaml/model/consolidation_rule/pattern_element_rule.rb,
lib/lutaml/model/error/transform_block_not_defined_error.rb,
lib/lutaml/model/schema/decorators/definition_collection.rb,
lib/lutaml/model/schema/generator/definitions_collection.rb,
lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb,
lib/lutaml/model/error/format_adapter_not_specified_error.rb,
lib/lutaml/model/error/no_attributes_defined_liquid_error.rb,
lib/lutaml/model/cached_type_resolver/concurrent_map_cache.rb,
lib/lutaml/model/error/collection_count_out_of_range_error.rb,
lib/lutaml/model/error/register/not_registrable_class_error.rb,
lib/lutaml/model/error/sorting_configuration_conflict_error.rb,
lib/lutaml/model/error/reverse_transformation_declaration_error.rb,
lib/lutaml/model/error/reverse_transform_block_not_defined_error.rb,
lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb

Defined Under Namespace

Modules: CollectionHandler, ComparableModel, Config, Consolidation, Constants, Error, Hash, Instrumentation, Json, JsonAdapter, Jsonl, Liquefiable, Liquid, Performance, Registrable, RenderPolicy, RuntimeCompatibility, Schema, Serialize, Services, Toml, Type, Utils, Validation, Yaml, Yamls Classes: Attribute, AttributeValidator, BaseModel, CachedTypeResolver, Choice, ChoiceLowerBoundError, ChoiceUpperBoundError, Cli, Collection, CollectionCountOutOfRangeError, CollectionTrueMissingError, ComparableNil, Comparison, CompiledRule, Configuration, ConsolidationMap, ConsolidationRule, ContextRegistry, DispatchBlock, DispatchBuilder, ElementCountOutOfRangeError, Errors, ExportTransformer, FinalizationCache, FormatAdapterNotSpecifiedError, FormatRegistry, GatherRule, GlobalContext, GlobalRegister, ImportModelWithRootError, ImportRegistry, ImportTransformer, IncorrectMappingArgumentsError, IncorrectModelError, IncorrectSequenceError, InvalidAttributeNameError, InvalidAttributeOptionsError, InvalidAttributeTypeError, InvalidChoiceRangeError, InvalidFormatError, InvalidValueError, LiquidClassNotFoundError, LiquidNotEnabledError, Listener, Logger, Mapping, MappingAlreadyExistsError, MappingAttributeMissingError, MappingAttributeTypeError, MappingHash, MappingRule, MixedContentCollectionError, ModelMapping, ModelMappingRule, ModelTransformer, ModelTreeImporter, MultipleMappingsError, NamespaceBinding, NoAttributesDefinedLiquidError, NoMappingFoundError, NoRootMappingError, NoRootNamespaceError, OneEntryCache, Organization, PatternContentRule, PatternElementRule, PatternNotMatchedError, PerformanceStats, PolymorphicError, Register, RequiredAttributeMissingError, ReverseTransformBlockNotDefinedError, ReverseTransformationDeclarationError, RuleValueExtractor, Sequence, Serializable, SerializationAdapter, SortingConfigurationConflictError, Store, Transform, TransformBlockNotDefinedError, Transformation, TransformationBuilder, TransformationRegistry, Transformer, TypeContext, TypeError, TypeNotEnabledError, TypeRegistry, TypeResolver, TypeSubstitution, UndefinedAttributeError, UninitializedClass, UnknownAdapterTypeError, UnknownSequenceMappingError, UnknownTypeError, UnresolvableTypeError, ValidationContext, ValidationError, ValidationFailedError, ValidationRule, Validator, ValueTransformer

Constant Summary collapse

VERSION =
"0.8.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationConfiguration

Get the current configuration

Returns:



214
215
216
# File 'lib/lutaml/model.rb', line 214

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|Configuration| ... } ⇒ Configuration

Module-level configuration

Examples:

Lutaml::Model.configure do |config|
  config.xml_adapter = :nokogiri
  config.json_adapter = :oj
end

Yields:

Returns:



205
206
207
208
209
# File 'lib/lutaml/model.rb', line 205

def self.configure
  @configuration ||= Configuration.new
  yield @configuration if block_given?
  @configuration
end

.reset_configuration!void

This method returns an undefined value.

Reset configuration to defaults



221
222
223
# File 'lib/lutaml/model.rb', line 221

def self.reset_configuration!
  @configuration = nil
end

Instance Method Details

#to_treeString

Generates a tree representation of the object

Returns:

  • (String)

    A string representation of the object’s attribute tree



563
564
565
566
567
568
569
570
571
572
573
# File 'lib/lutaml/model/comparable_model.rb', line 563

def to_tree
  output = "#{self.class}\n"
  self.class.attributes.each_with_index do |(name, type), index|
    value = send(name)
    is_last = index == self.class.attributes.length - 1
    context = DiffContext.new(nil, nil, show_unchanged: false)
    formatted = context.format_value(value)
    output << context.tree_line(is_last, "#{name} (#{type}): #{formatted}")
  end
  output
end