oxm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,10 +1,12 @@
1
+ ### 0.1.1 / 2011/09/19
2
+ * Bug fix: OXM::Object#compact! incorrectly nilified elements
1
3
  ### 0.1.0 / 2011/09/19
2
4
  * Disclaimer: Not compatible to the previous versions
3
- ** Removed: OXM::Object#cdata, OXM::Object#text, OXM::Object#text=
4
- ** Added: OXM::Object#content, OXM::Object#content=
5
- ** Changed: OXM::Object#to_s never returns nil
6
- ** Changed: OXM::Object#compact! removes empty elements as well (no text value, no attributes at all)
7
- ** Fix: Allows assignment of nil/empty string as element values
5
+ * Removed: OXM::Object#cdata, OXM::Object#text, OXM::Object#text=
6
+ * Added: OXM::Object#content, OXM::Object#content=
7
+ * Changed: OXM::Object#to_s never returns nil
8
+ * Changed: OXM::Object#compact! removes empty elements as well (no text value, no attributes at all)
9
+ * Fix: Allows assignment of nil/empty string as element values
8
10
 
9
11
  ### 0.0.2 / 2011/09/15
10
12
  * OXM::Object#compact! added
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/oxm/object.rb CHANGED
@@ -130,9 +130,9 @@ module OXM
130
130
  @data = nil
131
131
  end
132
132
 
133
- # @return [Boolean] Return if the element is empty (no text value and no attributes)
133
+ # @return [Boolean] Return if the element is empty (no text value, no attributes and no child elements)
134
134
  def empty?
135
- self.to_s.empty? && self.attributes.empty?
135
+ self.to_s.empty? && self.attributes.empty? && self.elements.empty?
136
136
  end
137
137
 
138
138
  private
data/test/test_oxm.rb CHANGED
@@ -134,11 +134,16 @@ class TestOxm < Test::Unit::TestCase
134
134
  <volume></volume>
135
135
  <volume></volume>
136
136
  </item>
137
+ <item dept="nil">
138
+ <volume><extra></extra></volume>
139
+ <volume><extra>2</extra></volume>
140
+ <volume></volume>
141
+ </item>
137
142
  </container>
138
143
  EOF
139
144
 
140
145
  items = OXM.from_xml(str, 'container/item')
141
- assert_equal 5, items.length
146
+ assert_equal 6, items.length
142
147
 
143
148
  items[0].compact!
144
149
  assert_equal Array, items[0].volume.class
@@ -162,5 +167,10 @@ class TestOxm < Test::Unit::TestCase
162
167
  assert_raise(NoMethodError) {
163
168
  items[4].voll
164
169
  }
170
+
171
+ items[5].compact!
172
+ assert_equal Array, items[5].volume.class
173
+ assert_equal 2, items[5].volume.length
174
+
165
175
  end
166
176
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &2160763840 !ruby/object:Gem::Requirement
16
+ requirement: &2152887260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160763840
24
+ version_requirements: *2152887260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &2160755540 !ruby/object:Gem::Requirement
27
+ requirement: &2152885680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160755540
35
+ version_requirements: *2152885680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2160753840 !ruby/object:Gem::Requirement
38
+ requirement: &2152884200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2160753840
46
+ version_requirements: *2152884200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &2160752880 !ruby/object:Gem::Requirement
49
+ requirement: &2152883120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2160752880
57
+ version_requirements: *2152883120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &2160752000 !ruby/object:Gem::Requirement
60
+ requirement: &2152882320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2160752000
68
+ version_requirements: *2152882320
69
69
  description: A tiny Object-XML-Mapper using Nokogiri SAX parser
70
70
  email: junegunn.c@gmail.com
71
71
  executables: []
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: 1267901525051297766
105
+ hash: 723951543129720723
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements: