rosemary 0.3.6 → 0.3.7
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.
- data/lib/rosemary/node.rb +1 -1
- data/lib/rosemary/relation.rb +7 -5
- data/lib/rosemary/tags.rb +4 -0
- data/lib/rosemary/version.rb +1 -1
- data/lib/rosemary/way.rb +1 -1
- data/spec/models/node_spec.rb +13 -0
- data/spec/models/way_spec.rb +8 -0
- metadata +2 -2
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
|
data/lib/rosemary/relation.rb
CHANGED
@@ -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(
|
29
|
+
def to_xml(options = {})
|
30
30
|
xml = options[:builder] ||= Builder::XmlMarkup.new
|
31
31
|
xml.instruct! unless options[:skip_instruct]
|
32
|
-
xml.
|
33
|
-
|
34
|
-
|
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
data/lib/rosemary/version.rb
CHANGED
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)
|
data/spec/models/node_spec.rb
CHANGED
@@ -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
|
data/spec/models/way_spec.rb
CHANGED
@@ -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.
|
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:
|
244
|
+
hash: -321215509293511542
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
none: false
|
247
247
|
requirements:
|