metar-parser 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metar/data/base.rb +15 -0
- data/lib/metar/data/density_altitude.rb +15 -0
- data/lib/metar/data/direction.rb +9 -0
- data/lib/metar/data/distance.rb +27 -0
- data/lib/metar/data/lightning.rb +61 -0
- data/lib/metar/data/observer.rb +24 -0
- data/lib/metar/data/pressure.rb +23 -0
- data/lib/metar/data/remark.rb +98 -0
- data/lib/metar/data/runway_visible_range.rb +85 -0
- data/lib/metar/data/sky_condition.rb +61 -0
- data/lib/metar/data/speed.rb +22 -0
- data/lib/metar/data/station_code.rb +7 -0
- data/lib/metar/data/temperature.rb +21 -0
- data/lib/metar/data/temperature_and_dew_point.rb +18 -0
- data/lib/metar/data/time.rb +54 -0
- data/lib/metar/data/variable_wind.rb +25 -0
- data/lib/metar/data/vertical_visibility.rb +26 -0
- data/lib/metar/data/visibility.rb +71 -0
- data/lib/metar/data/visibility_remark.rb +8 -0
- data/lib/metar/data/weather_phenomenon.rb +86 -0
- data/lib/metar/data/wind.rb +82 -0
- data/lib/metar/data.rb +22 -636
- data/lib/metar/i18n.rb +6 -0
- data/lib/metar/parser.rb +165 -120
- data/lib/metar/report.rb +1 -1
- data/lib/metar/version.rb +2 -2
- data/lib/metar.rb +7 -6
- data/locales/de.yml +1 -0
- data/locales/en.yml +1 -0
- data/locales/it.yml +2 -1
- data/locales/pt-BR.yml +1 -0
- data/spec/data/density_altitude_spec.rb +12 -0
- data/spec/{distance_spec.rb → data/distance_spec.rb} +1 -1
- data/spec/data/lightning_spec.rb +49 -0
- data/spec/data/pressure_spec.rb +22 -0
- data/spec/data/remark_spec.rb +99 -0
- data/spec/data/runway_visible_range_spec.rb +92 -0
- data/spec/{sky_condition_spec.rb → data/sky_condition_spec.rb} +10 -6
- data/spec/data/speed_spec.rb +45 -0
- data/spec/data/temperature_spec.rb +36 -0
- data/spec/{variable_wind_spec.rb → data/variable_wind_spec.rb} +6 -6
- data/spec/{vertical_visibility_spec.rb → data/vertical_visibility_spec.rb} +2 -2
- data/spec/{data_spec.rb → data/visibility_remark_spec.rb} +1 -11
- data/spec/{visibility_spec.rb → data/visibility_spec.rb} +9 -7
- data/spec/{weather_phenomenon_spec.rb → data/weather_phenomenon_spec.rb} +7 -3
- data/spec/{wind_spec.rb → data/wind_spec.rb} +10 -7
- data/spec/parser_spec.rb +107 -13
- data/spec/report_spec.rb +12 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/station_spec.rb +2 -1
- metadata +56 -31
- data/spec/pressure_spec.rb +0 -22
- data/spec/remark_spec.rb +0 -147
- data/spec/runway_visible_range_spec.rb +0 -81
- data/spec/speed_spec.rb +0 -45
- data/spec/temperature_spec.rb +0 -36
data/spec/temperature_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
describe Metar::Temperature do
|
5
|
-
context '.parse' do
|
6
|
-
it 'understands numbers' do
|
7
|
-
t = Metar::Temperature.parse('5')
|
8
|
-
|
9
|
-
expect(t.value).to be_within(0.01).of(5.0)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'treats an M-prefix as a negative indicator' do
|
13
|
-
t = Metar::Temperature.parse('M5')
|
14
|
-
|
15
|
-
expect(t.value).to be_within(0.01).of(-5.0)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'returns nil for other values' do
|
19
|
-
expect(Metar::Temperature.parse('')).to be_nil
|
20
|
-
expect(Metar::Temperature.parse('aaa')).to be_nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context '#to_s' do
|
25
|
-
it 'abbreviates the units' do
|
26
|
-
t = Metar::Temperature.new(5)
|
27
|
-
|
28
|
-
expect(t.to_s).to eq('5°C')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'rounds to the nearest degree' do
|
32
|
-
expect(Metar::Temperature.new(5.1).to_s).to eq('5°C')
|
33
|
-
expect(Metar::Temperature.new(5.5).to_s).to eq('6°C')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|