excemel 1.0.1-java → 1.0.2-java

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.
Files changed (3) hide show
  1. data/History.txt +5 -1
  2. data/lib/excemel/excemel.rb +9 -3
  3. metadata +1 -1
data/History.txt CHANGED
@@ -9,4 +9,8 @@
9
9
  == 1.0.1
10
10
 
11
11
  - added the ability to add attributes to the current document target (pointer
12
- to an element in the document)
12
+ to an element in the document)
13
+
14
+ == 1.0.2
15
+
16
+ - added the ability to remove attributes by passing nil as a value
@@ -257,12 +257,18 @@ module Excemel
257
257
  private
258
258
 
259
259
  # Adds attributes to the given Element (tag) as define by the parameter
260
- # target
260
+ # target, passing an attribute with a value of nil, removes the attribute if
261
+ # it exists
261
262
  def _add_attributes(target, attrs)
262
263
  if attrs
263
264
  attrs.each do |key, value|
264
- attribute = XOM::Attribute.new(key.to_s, value.to_s)
265
- target.add_attribute(attribute)
265
+ unless value.nil?
266
+ attribute = XOM::Attribute.new(key.to_s, value.to_s)
267
+ target.add_attribute(attribute)
268
+ else
269
+ attribute = target.get_attribute(key.to_s)
270
+ target.remove_attribute(attribute) if attribute
271
+ end
266
272
  end
267
273
  end
268
274
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: excemel
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: 1.0.2
6
6
  platform: java
7
7
  authors:
8
8
  - Brian Sam-Bodden