Class: Lutaml::Xsd::Schema

Inherits:
Model::Serializable
  • Object
show all
Defined in:
lib/lutaml/xsd/schema.rb

Overview

rubocop:disable Metrics/ClassLength

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_in_progress(location) ⇒ Object



165
166
167
# File 'lib/lutaml/xsd/schema.rb', line 165

def add_in_progress(location)
  in_progress << location
end

.in_progressObject



157
158
159
# File 'lib/lutaml/xsd/schema.rb', line 157

def in_progress
  @in_progress ||= []
end

.in_progress?(location) ⇒ Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/lutaml/xsd/schema.rb', line 161

def in_progress?(location)
  in_progress.include?(location)
end

.processed_schemasObject



143
144
145
# File 'lib/lutaml/xsd/schema.rb', line 143

def processed_schemas
  @processed_schemas ||= {}
end

.remove_in_progress(location) ⇒ Object



169
170
171
# File 'lib/lutaml/xsd/schema.rb', line 169

def remove_in_progress(location)
  in_progress.delete(location)
end

.reset_processed_schemasObject



139
140
141
# File 'lib/lutaml/xsd/schema.rb', line 139

def reset_processed_schemas
  @processed_schemas = {}
end

.schema_processed(location, schema) ⇒ Object



151
152
153
154
155
# File 'lib/lutaml/xsd/schema.rb', line 151

def schema_processed(location, schema)
  return if location.nil?

  processed_schemas[location] = schema
end

.schema_processed?(location) ⇒ Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/lutaml/xsd/schema.rb', line 147

def schema_processed?(location)
  processed_schemas[location]
end

Instance Method Details

#import_from_schema(model, value) ⇒ Object



57
58
59
60
61
# File 'lib/lutaml/xsd/schema.rb', line 57

def import_from_schema(model, value)
  value.each do |schema|
    setup_import_and_include("import", model, schema, namespace: schema["namespace"])
  end
end

#import_to_schema(model, parent, _doc) ⇒ Object



63
64
65
66
67
68
# File 'lib/lutaml/xsd/schema.rb', line 63

def import_to_schema(model, parent, _doc)
  model.imports.each_with_index do |imported_schema, index|
    parent.add_child(imported_schema.to_xml)
    model.imports.delete_at(index)
  end
end

#include_from_schema(model, value) ⇒ Object



70
71
72
73
74
# File 'lib/lutaml/xsd/schema.rb', line 70

def include_from_schema(model, value)
  value.each do |schema|
    setup_import_and_include("include", model, schema)
  end
end

#include_to_schema(model, parent, _doc) ⇒ Object



76
77
78
79
80
81
# File 'lib/lutaml/xsd/schema.rb', line 76

def include_to_schema(model, parent, _doc)
  model.includes.each_with_index do |schema_hash, index|
    parent.add_child(schema_hash.to_xml)
    model.includes.delete_at(index)
  end
end