rosemary 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rosemary/node.rb CHANGED
@@ -41,7 +41,7 @@ module Rosemary
41
41
  def to_xml(options = {})
42
42
  xml = options[:builder] ||= Builder::XmlMarkup.new
43
43
  xml.instruct! unless options[:skip_instruct]
44
- xml.osm do
44
+ xml.osm(:generator => "rosemary v#{Rosemary::VERSION}", :version => Rosemary::Api::API_VERSION) do
45
45
  xml.node(attributes) do
46
46
  tags.to_xml(:builder => xml, :skip_instruct => true)
47
47
  end
@@ -26,14 +26,16 @@ module Rosemary
26
26
 
27
27
  # Return XML for this relation. This method uses the Builder library.
28
28
  # The only parameter ist the builder object.
29
- def to_xml(option = {})
29
+ def to_xml(options = {})
30
30
  xml = options[:builder] ||= Builder::XmlMarkup.new
31
31
  xml.instruct! unless options[:skip_instruct]
32
- xml.relation(attributes) do
33
- members.each do |member|
34
- member.to_xml(:builder => xml, :skip_instruct => true)
32
+ xml.osm(:generator => "rosemary v#{Rosemary::VERSION}", :version => Rosemary::Api::API_VERSION) do
33
+ xml.relation(attributes) do
34
+ members.each do |member|
35
+ member.to_xml(:builder => xml, :skip_instruct => true)
36
+ end
37
+ tags.to_xml(:builder => xml, :skip_instruct => true)
35
38
  end
36
- tags.to_xml(:builder => xml, :skip_instruct => true)
37
39
  end
38
40
  end
39
41
 
data/lib/rosemary/tags.rb CHANGED
@@ -14,6 +14,10 @@ module Rosemary
14
14
  end unless empty?
15
15
  end
16
16
 
17
+ def []=(key, value)
18
+ super(key, value.strip)
19
+ end
20
+
17
21
  # Return string with comma separated key=value pairs.
18
22
  #
19
23
  # @return [String] string representation
@@ -1,4 +1,4 @@
1
1
  module Rosemary
2
2
  # The current version of this gem.
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
data/lib/rosemary/way.rb CHANGED
@@ -75,7 +75,7 @@ module Rosemary
75
75
  def to_xml(options = {})
76
76
  xml = options[:builder] ||= Builder::XmlMarkup.new
77
77
  xml.instruct! unless options[:skip_instruct]
78
- xml.osm do
78
+ xml.osm(:generator => "rosemary v#{Rosemary::VERSION}", :version => Rosemary::Api::API_VERSION) do
79
79
  xml.way(attributes) do
80
80
  nodes.each do |node_id|
81
81
  xml.nd(:ref => node_id)
@@ -85,6 +85,14 @@ describe Node do
85
85
  subject.to_xml.should match /uid=\"123\"/
86
86
  end
87
87
 
88
+ it "should have a version attribute for osm tag" do
89
+ subject.to_xml.should match /version=\"0.6\"/
90
+ end
91
+
92
+ it "should have a generator attribute for osm tag" do
93
+ subject.to_xml.should match /generator=\"rosemary v/
94
+ end
95
+
88
96
  it "should produce xml" do
89
97
  subject.add_tags(:wheelchair => 'yes')
90
98
  subject.to_xml.should match /k=\"wheelchair\"/
@@ -100,4 +108,9 @@ describe Node do
100
108
  subject.name = "foo & bar"
101
109
  subject.to_xml.should match "foo & bar"
102
110
  end
111
+
112
+ it "should properly strip leading and trailing whitespace" do
113
+ subject.name = " Allice and Bob "
114
+ subject.to_xml.should match "\"Allice and Bob\""
115
+ end
103
116
  end
@@ -69,6 +69,14 @@ describe Way do
69
69
  subject.to_xml.should match /uid=\"123\"/
70
70
  end
71
71
 
72
+ it "should have a version attribute for osm tag" do
73
+ subject.to_xml.should match /version=\"0.6\"/
74
+ end
75
+
76
+ it "should have a generator attribute for osm tag" do
77
+ subject.to_xml.should match /generator=\"rosemary v/
78
+ end
79
+
72
80
  it "should produce xml" do
73
81
  subject.add_tags(:wheelchair => 'yes')
74
82
  subject.to_xml.should match /k=\"wheelchair\"/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosemary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -241,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  segments:
243
243
  - 0
244
- hash: 2643441005731016607
244
+ hash: -321215509293511542
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  none: false
247
247
  requirements: