Class: XsdModel::Elements::Schema
- Inherits:
-
Object
- Object
- XsdModel::Elements::Schema
- Extended by:
- AttributeMethods
- Includes:
- BaseElement
- Defined in:
- lib/xsd_model/elements/schema.rb
Constant Summary
Constants included from BaseElement
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Attributes included from BaseElement
#attributes, #children, #css_path, #namespaces
Instance Method Summary collapse
- #_collect_imported_schemas(original_schema, options, already_collected = []) ⇒ Object
- #_collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = []) ⇒ Object
- #collect_imported_schemas(options = {}) ⇒ Object
- #collect_included_schemas(options = {}) ⇒ Object
-
#initialize(*args, attributes: {}, namespaces: {}, css_path: '') ⇒ Schema
constructor
A new instance of Schema.
Methods included from AttributeMethods
Methods included from BaseElement
#==, #basic_xsd_type?, #element_name, #empty?, #has_custom_type?, #method_missing, #name_with_prefix, #reverse_traverse, #type_with_prefix, #xmlns_prefix, #xmlns_uri, #xsd_prefix
Constructor Details
#initialize(*args, attributes: {}, namespaces: {}, css_path: '') ⇒ Schema
10 11 12 13 |
# File 'lib/xsd_model/elements/schema.rb', line 10 def initialize(*args, attributes: {}, namespaces: {}, css_path: '') super @source = '(initial)' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class XsdModel::Elements::BaseElement
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/xsd_model/elements/schema.rb', line 7 def source @source end |
Instance Method Details
#_collect_imported_schemas(original_schema, options, already_collected = []) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/xsd_model/elements/schema.rb', line 19 def _collect_imported_schemas(original_schema, , 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() already_collected << new_schema _collect_imported_schemas(new_schema, , already_collected) end end already_collected end |
#_collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = []) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/xsd_model/elements/schema.rb', line 37 def _collect_included_schemas(original_schema, , collected_schemas = [], collected_paths = []) includes = original_schema.includes includes.each do |incl| unless collected_paths.include? incl.schema_location new_schema = incl.load() collected_schemas << new_schema collected_paths << incl.schema_location _collect_included_schemas(new_schema, , collected_schemas, collected_paths) end end collected_schemas end |
#collect_imported_schemas(options = {}) ⇒ Object
15 16 17 |
# File 'lib/xsd_model/elements/schema.rb', line 15 def collect_imported_schemas( = {}) _collect_imported_schemas(self, ) end |
#collect_included_schemas(options = {}) ⇒ Object
33 34 35 |
# File 'lib/xsd_model/elements/schema.rb', line 33 def collect_included_schemas( = {}) _collect_included_schemas(self, ) end |