Class: XsdModel::Elements::Schema

Inherits:
Object
  • Object
show all
Extended by:
AttributeMethods
Includes:
BaseElement
Defined in:
lib/xsd_model/elements/schema.rb

Constant Summary

Constants included from BaseElement

BaseElement::XSD_URI

Instance Attribute Summary

Attributes included from BaseElement

#attributes, #children, #namespaces

Instance Method Summary collapse

Methods included from AttributeMethods

attribute_method

Methods included from BaseElement

#==, #basic_xsd_type?, #element_name, #empty?, #has_custom_type?, #initialize, #method_missing, #reverse_traverse, #xsd_prefix

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XsdModel::Elements::BaseElement

Instance Method Details

#_collect_imported_schemas(original_schema, options, already_collected = []) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xsd_model/elements/schema.rb', line 13

def _collect_imported_schemas(original_schema, options, already_collected = [])
  imports = original_schema.imports

  imports.each do |import|
    unless already_collected.map { |d| d.target_namespace }.include? import.namespace
      new_schema = import.load(options)
      already_collected << new_schema
      _collect_imported_schemas(new_schema, options, already_collected)
    end
  end

  already_collected
end

#_collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = []) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/xsd_model/elements/schema.rb', line 31

def _collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = [])
  includes = original_schema.includes

  includes.each do |incl|
    unless collected_paths.include? incl.schema_location
      new_schema = incl.load(options)
      collected_schemas << new_schema
      collected_paths << incl.schema_location

      _collect_included_schemas(new_schema, options, collected_schemas, collected_paths)
    end
  end

  collected_schemas
end

#collect_imported_schemas(options = {}) ⇒ Object



9
10
11
# File 'lib/xsd_model/elements/schema.rb', line 9

def collect_imported_schemas(options = {})
  _collect_imported_schemas(self, options)
end

#collect_included_schemas(options = {}) ⇒ Object



27
28
29
# File 'lib/xsd_model/elements/schema.rb', line 27

def collect_included_schemas(options = {})
  _collect_included_schemas(self, options)
end