xml_schema_mapper 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module XmlSchemaMapper
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -74,6 +74,14 @@ module XmlSchemaMapper
74
74
  def attrs
75
75
  @attrs ||= type.attributes
76
76
  end
77
+
78
+ def build_tree
79
+ instance = new
80
+ self.elements.each do |e|
81
+ instance[e.reader] = e.mapper_class.build_tree if e.complex?
82
+ end
83
+ instance
84
+ end
77
85
  end
78
86
 
79
87
  delegate :first, :last, :each, :length, :size, :all?, :any?, :one?, :empty?, to: :element_values
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: xml_schema_mapper
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Anton Sozontov
@@ -123,8 +123,6 @@ files:
123
123
  - README.md
124
124
  - Rakefile
125
125
  - bin/xml_schema_mapper
126
- - lib/thor/templates/converter_class.erb
127
- - lib/thor/templates/converter_spec.erb
128
126
  - lib/thor/templates/mapper_class.erb
129
127
  - lib/thor/templates/mapper_spec.erb
130
128
  - lib/thor/xsd_mappers.rb
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
- # @note <%= type.annotation.to_s.gsub("\n", "\n# ") %>
3
-
4
- <%- elements.each do |element| -%>
5
- <%- (element.annotation || element.type.annotation).each_line do |line| -%>
6
- # <%= line %>
7
- <%- end -%>
8
- # @attr <%= element.name %> [<%= element.type.name %>]
9
- <%- end -%>
10
-
11
- <%- if options[:converter_module_name].present? -%>
12
- class <%= options[:converter_module_name] %>::<%= converter_name %> < Converter
13
- <% else -%>
14
- class <%= converter_name %> < Converter
15
- <% end -%>
16
-
17
- <%- elements.each do |element| -%>
18
- map mapper: :<%= element.name.underscore %>, model: :<%= element.name.underscore %>
19
- <%- end -%>
20
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- <%- elements.each do |element| -%>
4
- # @attr <%= element.name %> [<%= element.type.name %>]
5
- <%- end %>
6
-
7
- <%- if options[:converter_module_name].present? -%>
8
- describe <%= options[:converter_module_name] %>::<%= converter_name %> do
9
- <% else -%>
10
- describe <%= converter_name %> do
11
- <% end -%>
12
- end