Class: WsdlMapper::Dom::Schema
- Inherits:
-
Object
- Object
- WsdlMapper::Dom::Schema
- Includes:
- WsdlMapper::Dom
- Defined in:
- lib/wsdl_mapper/dom/schema.rb
Instance Attribute Summary (collapse)
-
- (Object) attributes
readonly
Returns the value of attribute attributes.
-
- (Object) elements
readonly
Returns the value of attribute elements.
-
- (Object) imports
readonly
Returns the value of attribute imports.
-
- (Object) qualified_attributes
Returns the value of attribute qualified_attributes.
-
- (Object) qualified_elements
Returns the value of attribute qualified_elements.
-
- (Object) target_namespace
Returns the value of attribute target_namespace.
-
- (Object) types
readonly
Returns the value of attribute types.
-
- (Object) unresolved_imports
readonly
Returns the value of attribute unresolved_imports.
Instance Method Summary (collapse)
- - (Object) add_attribute(attr)
- - (Object) add_element(element)
- - (Object) add_import(ns, schema)
- - (Object) add_type(type)
- - (Object) each_attribute(&block)
- - (Object) each_builtin_type(&block)
- - (Object) each_element(&block)
- - (Object) each_soap_encoding_type(&block)
- - (Object) each_type(&block)
- - (Object) get_attribute(name)
- - (Object) get_element(name)
- - (Object) get_type(name)
-
- (Schema) initialize
constructor
A new instance of Schema.
Constructor Details
- (Schema) initialize
Returns a new instance of Schema
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 13 def initialize @types = Directory.new @anon_types = [] @elements = Directory.new @attributes = Directory.new @builtin_types = Directory.new @soap_encoding_types = Directory.new @qualified_elements = false @qualified_attributes = false @imports = [] @unresolved_imports = [] end |
Instance Attribute Details
- (Object) attributes (readonly)
Returns the value of attribute attributes
10 11 12 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 10 def attributes @attributes end |
- (Object) elements (readonly)
Returns the value of attribute elements
10 11 12 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 10 def elements @elements end |
- (Object) imports (readonly)
Returns the value of attribute imports
10 11 12 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 10 def imports @imports end |
- (Object) qualified_attributes
Returns the value of attribute qualified_attributes
11 12 13 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 11 def qualified_attributes @qualified_attributes end |
- (Object) qualified_elements
Returns the value of attribute qualified_elements
11 12 13 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 11 def qualified_elements @qualified_elements end |
- (Object) target_namespace
Returns the value of attribute target_namespace
11 12 13 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 11 def target_namespace @target_namespace end |
- (Object) types (readonly)
Returns the value of attribute types
10 11 12 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 10 def types @types end |
- (Object) unresolved_imports (readonly)
Returns the value of attribute unresolved_imports
10 11 12 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 10 def unresolved_imports @unresolved_imports end |
Instance Method Details
- (Object) add_attribute(attr)
43 44 45 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 43 def add_attribute(attr) @attributes[attr.name] = attr end |
- (Object) add_element(element)
39 40 41 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 39 def add_element(element) @elements[element.name] = element end |
- (Object) add_import(ns, schema)
26 27 28 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 26 def add_import(ns, schema) @imports << schema end |
- (Object) add_type(type)
30 31 32 33 34 35 36 37 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 30 def add_type(type) if type.name @types[type.name] = type else @anon_types << type end type end |
- (Object) each_attribute(&block)
91 92 93 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 91 def each_attribute(&block) recursive_each @attributes, :each_attribute, &block end |
- (Object) each_builtin_type(&block)
95 96 97 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 95 def each_builtin_type(&block) @builtin_types.values.each &block end |
- (Object) each_element(&block)
87 88 89 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 87 def each_element(&block) recursive_each @elements, :each_element, &block end |
- (Object) each_soap_encoding_type(&block)
99 100 101 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 99 def each_soap_encoding_type(&block) @soap_encoding_types.values.each &block end |
- (Object) each_type(&block)
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 69 def each_type(&block) enum = Enumerator.new do |y| @types.each do |(n, t)| y << t end @anon_types.each do |t| y << t end @imports.each do |i| i.each_type do |t| y << t end end end block_given? ? enum.each(&block) : enum end |
- (Object) get_attribute(name)
65 66 67 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 65 def get_attribute(name) @attributes[name] || @imports.lazy.map { |s| s.get_attribute(name) }.reject(&:nil?).first end |
- (Object) get_element(name)
61 62 63 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 61 def get_element(name) @elements[name] || @imports.lazy.map { |s| s.get_element(name) }.reject(&:nil?).first end |
- (Object) get_type(name)
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/wsdl_mapper/dom/schema.rb', line 47 def get_type(name) return if name.nil? if name.ns == BuiltinType::NAMESPACE @builtin_types[name] ||= BuiltinType.types[name] elsif name.ns == SoapEncodingType::NAMESPACE @soap_encoding_types[name] ||= SoapEncodingType.types[name] elsif type = @types[name] type else @imports.lazy.map { |s| s.get_type(name) }.reject(&:nil?).first end end |