troelskn-handsoap 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/handsoap/xml_mason.rb +6 -8
  3. metadata +2 -2
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 1
@@ -14,9 +14,9 @@ module Handsoap
14
14
  def initialize
15
15
  @namespaces = {}
16
16
  end
17
- def add(node_name, value = nil, options = {})
17
+ def add(node_name, value = nil)
18
18
  prefix, name = parse_ns(node_name)
19
- node = append_child Element.new(self, prefix, name, value, options)
19
+ node = append_child Element.new(self, prefix, name, value)
20
20
  if block_given?
21
21
  yield node
22
22
  end
@@ -74,12 +74,12 @@ module Handsoap
74
74
  @text = text
75
75
  end
76
76
  def to_s(indentation = '')
77
- XmlMason.html_escape(@text).gsub(/\n/, "\n" + indentation)
77
+ XmlMason.html_escape(@text)
78
78
  end
79
79
  end
80
80
 
81
81
  class Element < Node
82
- def initialize(parent, prefix, node_name, value = nil, options = {})
82
+ def initialize(parent, prefix, node_name, value = nil)
83
83
  super()
84
84
  # if prefix.to_s == ""
85
85
  # raise "missing prefix"
@@ -89,7 +89,6 @@ module Handsoap
89
89
  @node_name = node_name
90
90
  @children = []
91
91
  @attributes = {}
92
- @indent_children = options[:indent] != false # default to true, can override to false
93
92
  if not value.nil?
94
93
  set_value value.to_s
95
94
  end
@@ -160,11 +159,10 @@ module Handsoap
160
159
  name = XmlMason.html_escape(full_name)
161
160
  attr = (@attributes.any? ? (" " + @attributes.map { |key, value| XmlMason.html_escape(key) + '="' + XmlMason.html_escape(value) + '"' }.join(" ")) : "")
162
161
  if @children.any?
163
- child_indent = @indent_children ? (indentation + " ") : ""
164
162
  if value_node?
165
- children = @children[0].to_s(child_indent)
163
+ children = @children[0].to_s(indentation + " ")
166
164
  else
167
- children = @children.map { |node| "\n" + node.to_s(child_indent) }.join("") + "\n" + indentation
165
+ children = @children.map { |node| "\n" + node.to_s(indentation + " ") }.join("") + "\n" + indentation
168
166
  end
169
167
  indentation + "<" + name + attr + ">" + children + "</" + name + ">"
170
168
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: troelskn-handsoap
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
  - Troels Knak-Nielsen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-28 00:00:00 -07:00
12
+ date: 2009-04-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency