Module: Lutaml::Model

Defined in:
lib/lutaml/model.rb,
lib/lutaml/model/cli.rb,
lib/lutaml/model/xml.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/utils.rb,
lib/lutaml/model/choice.rb,
lib/lutaml/model/config.rb,
lib/lutaml/model/schema.rb,
lib/lutaml/model/version.rb,
lib/lutaml/model/sequence.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/comparison.rb,
lib/lutaml/model/type/float.rb,
lib/lutaml/model/type/value.rb,
lib/lutaml/model/validation.rb,
lib/lutaml/model/liquefiable.rb,
lib/lutaml/model/type/string.rb,
lib/lutaml/model/xml/element.rb,
lib/lutaml/model/xml/mapping.rb,
lib/lutaml/model/xml_adapter.rb,
lib/lutaml/model/hash/mapping.rb,
lib/lutaml/model/json/mapping.rb,
lib/lutaml/model/json_adapter.rb,
lib/lutaml/model/mapping_hash.rb,
lib/lutaml/model/serializable.rb,
lib/lutaml/model/toml/mapping.rb,
lib/lutaml/model/type/boolean.rb,
lib/lutaml/model/type/decimal.rb,
lib/lutaml/model/type/integer.rb,
lib/lutaml/model/xml/document.rb,
lib/lutaml/model/yaml/mapping.rb,
lib/lutaml/model/hash/document.rb,
lib/lutaml/model/json/document.rb,
lib/lutaml/model/toml/document.rb,
lib/lutaml/model/xml/transform.rb,
lib/lutaml/model/yaml/document.rb,
lib/lutaml/model/comparable_nil.rb,
lib/lutaml/model/hash/transform.rb,
lib/lutaml/model/json/transform.rb,
lib/lutaml/model/toml/transform.rb,
lib/lutaml/model/type/date_time.rb,
lib/lutaml/model/xml/builder/ox.rb,
lib/lutaml/model/xml/ox_adapter.rb,
lib/lutaml/model/yaml/transform.rb,
lib/lutaml/model/format_registry.rb,
lib/lutaml/model/mapping/mapping.rb,
lib/lutaml/model/schema_location.rb,
lib/lutaml/model/services/logger.rb,
lib/lutaml/model/xml/builder/oga.rb,
lib/lutaml/model/xml/oga/element.rb,
lib/lutaml/model/xml/oga_adapter.rb,
lib/lutaml/model/xml/xml_element.rb,
lib/lutaml/model/comparable_model.rb,
lib/lutaml/model/error/type_error.rb,
lib/lutaml/model/xml/mapping_rule.rb,
lib/lutaml/model/xml/oga/document.rb,
lib/lutaml/model/hash/mapping_rule.rb,
lib/lutaml/model/json/mapping_rule.rb,
lib/lutaml/model/schema/xsd_schema.rb,
lib/lutaml/model/toml/mapping_rule.rb,
lib/lutaml/model/xml/xml_attribute.rb,
lib/lutaml/model/xml/xml_namespace.rb,
lib/lutaml/model/yaml/mapping_rule.rb,
lib/lutaml/model/key_value_document.rb,
lib/lutaml/model/schema/json_schema.rb,
lib/lutaml/model/schema/yaml_schema.rb,
lib/lutaml/model/schema/xml_compiler.rb,
lib/lutaml/model/toml/tomlib_adapter.rb,
lib/lutaml/model/uninitialized_class.rb,
lib/lutaml/model/xml_adapter/element.rb,
lib/lutaml/model/mapping/mapping_rule.rb,
lib/lutaml/model/services/transformer.rb,
lib/lutaml/model/toml/toml_rb_adapter.rb,
lib/lutaml/model/xml/builder/nokogiri.rb,
lib/lutaml/model/xml/nokogiri_adapter.rb,
lib/lutaml/model/hash/standard_adapter.rb,
lib/lutaml/model/json/standard_adapter.rb,
lib/lutaml/model/schema/relaxng_schema.rb,
lib/lutaml/model/serialization_adapter.rb,
lib/lutaml/model/yaml/standard_adapter.rb,
lib/lutaml/model/error/validation_error.rb,
lib/lutaml/model/type/time_without_date.rb,
lib/lutaml/model/xml_adapter/ox_adapter.rb,
lib/lutaml/model/error/polymorphic_error.rb,
lib/lutaml/model/json/multi_json_adapter.rb,
lib/lutaml/model/transform/xml_transform.rb,
lib/lutaml/model/xml_adapter/oga_adapter.rb,
lib/lutaml/model/error/unknown_type_error.rb,
lib/lutaml/model/error/invalid_value_error.rb,
lib/lutaml/model/mapping/key_value_mapping.rb,
lib/lutaml/model/schema/json_schema_parser.rb,
lib/lutaml/model/error/no_root_mapping_error.rb,
lib/lutaml/model/error/type_not_enabled_error.rb,
lib/lutaml/model/schema/templates/simple_type.rb,
lib/lutaml/model/xml_adapter/nokogiri_adapter.rb,
lib/lutaml/model/error/multiple_mappings_error.rb,
lib/lutaml/model/error/no_root_namespace_error.rb,
lib/lutaml/model/transform/key_value_transform.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/mapping/key_value_mapping_rule.rb,
lib/lutaml/model/error/pattern_not_matched_error.rb,
lib/lutaml/model/error/invalid_choice_range_error.rb,
lib/lutaml/model/error/unknown_adapter_type_error.rb,
lib/lutaml/model/error/import_model_with_root_error.rb,
lib/lutaml/model/error/collection_true_missing_error.rb,
lib/lutaml/model/error/unknown_sequence_mapping_error.rb,
lib/lutaml/model/error/incorrect_mapping_argument_error.rb,
lib/lutaml/model/error/collection_count_out_of_range_error.rb

Defined Under Namespace

Modules: ComparableModel, Config, Constants, HashAdapter, Json, JsonAdapter, Liquefiable, Schema, Serialize, Toml, Type, Utils, Validation, Xml, XmlAdapter, Yaml Classes: Attribute, BaseModel, Choice, ChoiceLowerBoundError, ChoiceUpperBoundError, Cli, CollectionCountOutOfRangeError, CollectionTrueMissingError, ComparableNil, Comparison, Error, ExportTransformer, FormatRegistry, ImportModelWithRootError, ImportTransformer, IncorrectMappingArgumentsError, IncorrectModelError, IncorrectSequenceError, InvalidChoiceRangeError, InvalidValueError, KeyValueDocument, KeyValueMapping, KeyValueMappingRule, KeyValueTransform, LiquidNotEnabledError, Location, Logger, Mapping, MappingHash, MappingRule, MultipleMappingsError, NoRootMappingError, NoRootNamespaceError, PatternNotMatchedError, PolymorphicError, SchemaLocation, Sequence, Serializable, SerializationAdapter, Transform, Transformer, TypeError, TypeNotEnabledError, UninitializedClass, UnknownAdapterTypeError, UnknownSequenceMappingError, UnknownTypeError, ValidationError, XmlTransform

Constant Summary collapse

VERSION =
"0.7.2"

Instance Method Summary collapse

Instance Method Details

#to_treeString

Generates a tree representation of the object

Returns:

  • (String)

    A string representation of the object’s attribute tree



555
556
557
558
559
560
561
562
563
564
565
# File 'lib/lutaml/model/comparable_model.rb', line 555

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