xml-purifier 0.1.1 → 0.1.2

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 (2) hide show
  1. data/lib/xml-purifier.rb +8 -12
  2. metadata +1 -1
data/lib/xml-purifier.rb CHANGED
@@ -20,33 +20,29 @@ class XMLPurifier
20
20
  if elem.text and elem.text.to_s[/^[\{\[][^\}\]]+[\}\]]$/] then
21
21
 
22
22
  obj = JSON.parse(elem.text)
23
- method('to_' + opt[:to].to_s.to_sym).call(elem, obj)
23
+ method('to_' + opt[:to].to_s.to_sym).call(elem, scan_obj_to_xml(obj))
24
24
  end
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- def to_xml()
30
- @doc.to_s
31
- end
29
+ def to_xml() @doc.to_s end
32
30
 
33
31
  private
34
32
 
35
- def to_default(elem, obj)
36
- node_xml = "<%s>%s</%s>" % [elem.name, scan_obj_to_xml(obj), elem.name]
33
+ def to_default(elem, xml)
34
+ node_xml = "<%s>%s</%s>" % [elem.name, xml, elem.name]
37
35
  elem.parent.add_element Document.new(node_xml).root
38
36
  elem.parent.delete elem
39
37
  end
40
38
 
41
39
  alias to_native to_default
42
40
 
43
- def to_cdata(elem, obj)
44
- elem.text = CData.new(scan_obj_to_xml(obj))
45
- end
41
+ def to_cdata(elem, xml) elem.text = CData.new(xml) end
46
42
 
47
- def to_escaped(elem, obj) elem.text = scan_obj_to_xml(obj) end
43
+ def to_escaped(elem, xml) elem.text = xml end
48
44
 
49
- def string_to_xml(x) x end
45
+ def string_to_xml(x) x end
50
46
 
51
47
  def hash_to_xml(x)
52
48
  x.map do |k,v|
@@ -63,4 +59,4 @@ class XMLPurifier
63
59
  method("%s_to_xml" % o.class.to_s.downcase.to_sym).call(o)
64
60
  end
65
61
 
66
- end
62
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-purifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors: []
7
7