metar-parser 1.6.0 → 1.7.0
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.
- checksums.yaml +4 -4
- data/lib/metar/station.rb +1 -1
- data/lib/metar/version.rb +1 -1
- data/spec/station_spec.rb +50 -9
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7f1558724e63f52aee14e0f1775c7f4dc90eb187c9d3060426d7ab14de16fe4
|
4
|
+
data.tar.gz: 189365393cc681c9398dc78fe9d941fb56166276dea4645f1f56a93fef19394f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 376de6502034e38fa3581b4c0b7c6cc0df72d4067ae20337c12f3f5f294ca926587628a0a1769848a682545ad04a59b2547fd2697db5aafe73d67e4497c9adb5
|
7
|
+
data.tar.gz: 55bc69ff0cf47c5b7c6a207fe6d56327bc3e0c4c9b9f6b262807c32e13ff554ee611a21158d62acb92426a0223533590a2a221c7dcfab2cced49e8748eb4cdff
|
data/lib/metar/station.rb
CHANGED
data/lib/metar/version.rb
CHANGED
data/spec/station_spec.rb
CHANGED
@@ -104,6 +104,12 @@ describe Metar::Station do
|
|
104
104
|
expect(Metar::Station.to_longitude("055-24E")).to eq(55.4)
|
105
105
|
end
|
106
106
|
|
107
|
+
context "with Western values" do
|
108
|
+
it "returns negative results" do
|
109
|
+
expect(Metar::Station.to_longitude("055-24W")).to eq(-55.4)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
107
113
|
it "returns nil for badly formed strings" do
|
108
114
|
expect(Metar::Station.to_longitude("aaa")).to be_nil
|
109
115
|
end
|
@@ -111,7 +117,13 @@ describe Metar::Station do
|
|
111
117
|
|
112
118
|
context ".to_latitude" do
|
113
119
|
it "converts strings to latitude" do
|
114
|
-
expect(Metar::Station.to_latitude("11-
|
120
|
+
expect(Metar::Station.to_latitude("11-03N")).to eq(11.05)
|
121
|
+
end
|
122
|
+
|
123
|
+
context "with Southern values" do
|
124
|
+
it "returns negative results" do
|
125
|
+
expect(Metar::Station.to_latitude("11-03S")).to eq(-11.05)
|
126
|
+
end
|
115
127
|
end
|
116
128
|
|
117
129
|
it "returns nil for badly formed strings" do
|
@@ -123,12 +135,25 @@ describe Metar::Station do
|
|
123
135
|
let(:name) { "Station name" }
|
124
136
|
let(:state) { "State" }
|
125
137
|
let(:country) { "Country" }
|
138
|
+
let(:longitude) { "055-24E" }
|
139
|
+
let(:latitude) { "11-03N" }
|
126
140
|
let(:noaa_raw) do
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
141
|
+
[
|
142
|
+
cccc,
|
143
|
+
"00",
|
144
|
+
"000",
|
145
|
+
name,
|
146
|
+
state,
|
147
|
+
country,
|
148
|
+
"1",
|
149
|
+
latitude,
|
150
|
+
longitude,
|
151
|
+
latitude,
|
152
|
+
longitude,
|
153
|
+
"000",
|
154
|
+
"000",
|
155
|
+
"P"
|
156
|
+
].join(";")
|
132
157
|
end
|
133
158
|
let(:noaa_data) do
|
134
159
|
{
|
@@ -136,8 +161,8 @@ describe Metar::Station do
|
|
136
161
|
name: name,
|
137
162
|
state: state,
|
138
163
|
country: country,
|
139
|
-
longitude:
|
140
|
-
latitude:
|
164
|
+
longitude: longitude,
|
165
|
+
latitude: latitude,
|
141
166
|
raw: noaa_raw
|
142
167
|
}
|
143
168
|
end
|
@@ -175,8 +200,24 @@ describe Metar::Station do
|
|
175
200
|
specify { expect(subject.state).to eq(state) }
|
176
201
|
specify { expect(subject.country).to eq(country) }
|
177
202
|
specify { expect(subject.longitude).to eq(55.4) }
|
178
|
-
specify { expect(subject.latitude).to eq(
|
203
|
+
specify { expect(subject.latitude).to eq(11.05) }
|
179
204
|
specify { expect(subject.raw).to eq(noaa_raw) }
|
205
|
+
|
206
|
+
context "when longitude is Western" do
|
207
|
+
let(:longitude) { "055-24W" }
|
208
|
+
|
209
|
+
it "is parsed as negative" do
|
210
|
+
expect(subject.longitude).to eq(-55.4)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
context "When latitude is Southern" do
|
215
|
+
let(:latitude) { "11-03S" }
|
216
|
+
|
217
|
+
it "is parsed as negative" do
|
218
|
+
expect(subject.latitude).to eq(-11.05)
|
219
|
+
end
|
220
|
+
end
|
180
221
|
end
|
181
222
|
end
|
182
223
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metar-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Yates
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -235,7 +235,7 @@ files:
|
|
235
235
|
homepage: https://github.com/joeyates/metar-parser
|
236
236
|
licenses: []
|
237
237
|
metadata: {}
|
238
|
-
post_install_message:
|
238
|
+
post_install_message:
|
239
239
|
rdoc_options: []
|
240
240
|
require_paths:
|
241
241
|
- lib
|
@@ -250,8 +250,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: '0'
|
252
252
|
requirements: []
|
253
|
-
rubygems_version: 3.1
|
254
|
-
signing_key:
|
253
|
+
rubygems_version: 3.0.3.1
|
254
|
+
signing_key:
|
255
255
|
specification_version: 4
|
256
256
|
summary: A Ruby gem for worldwide weather reports
|
257
257
|
test_files:
|