macasek-happymapper 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/happymapper.gemspec +1 -1
  2. data/lib/happymapper.rb +14 -5
  3. metadata +1 -1
data/happymapper.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{happymapper}
5
- s.version = "0.2.5"
5
+ s.version = "0.2.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Nunemaker"]
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
- attributes.each do |attr|
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
- elements.each do |elem|
116
+
117
+ elems.each do |elem|
109
118
  obj.send("#{elem.method_name}=",
110
119
  elem.from_xml_node(n, namespace))
111
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macasek-happymapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker