macasek-happymapper 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/happymapper.gemspec +1 -1
- data/lib/happymapper.rb +14 -5
- metadata +1 -1
data/happymapper.gemspec
CHANGED
data/lib/happymapper.rb
CHANGED
@@ -95,17 +95,26 @@ module HappyMapper
|
|
95
95
|
xpath = root ? '/' : './/'
|
96
96
|
xpath += "#{namespace}:" if namespace
|
97
97
|
xpath += options[:tag] ? options[:tag] : tag_name
|
98
|
-
|
98
|
+
|
99
99
|
nodes = node.find(xpath)
|
100
100
|
collection = nodes.collect do |n|
|
101
101
|
obj = new
|
102
|
-
|
103
|
-
|
102
|
+
|
103
|
+
attrs = attributes
|
104
|
+
elems = elements
|
105
|
+
klass = self.superclass
|
106
|
+
while !klass.nil? && (klass != Object)
|
107
|
+
elems += klass.elements if(klass.respond_to?(:elements))
|
108
|
+
attrs += klass.attributes if(klass.respond_to?(:attributes))
|
109
|
+
klass = (klass != self.superclass) ? self.superclass : nil
|
110
|
+
end
|
111
|
+
|
112
|
+
attrs.each do |attr|
|
104
113
|
obj.send("#{attr.method_name}=",
|
105
114
|
attr.from_xml_node(n, namespace))
|
106
115
|
end
|
107
|
-
|
108
|
-
|
116
|
+
|
117
|
+
elems.each do |elem|
|
109
118
|
obj.send("#{elem.method_name}=",
|
110
119
|
elem.from_xml_node(n, namespace))
|
111
120
|
end
|