metar-parser 1.3.0 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae0329de719ceb6a7302bf28a0b2eb60224b6220
4
- data.tar.gz: 2f480c17d9cd2f3df30ee882ebbf45605bdae90d
3
+ metadata.gz: f2e0388461861adfdb50306cdb0b8044056ba41f
4
+ data.tar.gz: 160ed08277376b4f977b1fc67a0bd97d6969ac76
5
5
  SHA512:
6
- metadata.gz: a1c5d02054171c2b5d1a70d01caf6be3a2af8fa574e7a1b93595e0e5ce9e2b079bcab873bf2b2a82b9331c2dea2b7df01d493fe40f234d198c0f1c6b71712c32
7
- data.tar.gz: ae061b3580ad88b8463af928ae8537bc58a99ae95c3553a9eb68a89320f4fa5712de1e6a84bfefe5cc0bdb7e877fbf7e619c59844e83a72a8e0f7d618ae244ee
6
+ metadata.gz: df0e0d548d8365d4b637e6fc75287891f640f8df24534a4849fd4d7e805bd389460096eccfd5040a0cf16dc7df74b2936cd996b2ba41e7fd13fdbf3d73e00af7
7
+ data.tar.gz: aed5bba18e4875247db0f99762bf9babaf9ff3cc79ada5483ca4c601db6d15fb8360a2a43a5b7af99279ae914881b52a86559e9682a7d138dee282b8cd8cd77d
data/README.md CHANGED
@@ -100,6 +100,10 @@ I18n.locale = :'en-US'
100
100
  I18n.t('metar.station_code.title') # station code
101
101
  ```
102
102
 
103
+ # The METAR Format
104
+
105
+ See `doc/metar_format`.
106
+
103
107
  # Compliance
104
108
 
105
109
  By default, the parser runs in 'loose' compliance mode. That means that it tries to
data/lib/metar/parser.rb CHANGED
@@ -120,6 +120,10 @@ module Metar
120
120
 
121
121
  def analyze
122
122
  @chunks = @metar.split(' ')
123
+ # Strip final '='
124
+ if !strict? && @chunks.length > 0
125
+ @chunks[-1].gsub!(/\s?=$/, '')
126
+ end
123
127
 
124
128
  @station_code = nil
125
129
  @time = nil
data/lib/metar/version.rb CHANGED
@@ -2,7 +2,7 @@ module Metar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/parser_spec.rb CHANGED
@@ -328,6 +328,46 @@ describe Metar::Parser do
328
328
  end
329
329
  end
330
330
  end
331
+
332
+ context "final '='" do
333
+ let(:parser) {setup_parser('LPPT 070530Z 34003KT 310V010 CAVOK 14/12 Q1013=')}
334
+
335
+ it 'parses the final chunk' do
336
+ expect(parser.sea_level_pressure.value).to eq(1.013)
337
+ end
338
+
339
+ context 'in strict mode' do
340
+ before do
341
+ Metar::Parser.compliance = :strict
342
+ end
343
+
344
+ it 'causes and error' do
345
+ expect do
346
+ parser
347
+ end.to raise_error(Metar::ParseError, /Unparsable text found/)
348
+ end
349
+ end
350
+ end
351
+
352
+ context "final ' ='" do
353
+ let(:parser) {setup_parser('LPPT 070530Z 34003KT 310V010 CAVOK 14/12 Q1013 =')}
354
+
355
+ it 'parses the final chunk' do
356
+ expect(parser.sea_level_pressure.value).to eq(1.013)
357
+ end
358
+
359
+ context 'in strict mode' do
360
+ before do
361
+ Metar::Parser.compliance = :strict
362
+ end
363
+
364
+ it 'causes and error' do
365
+ expect do
366
+ parser
367
+ end.to raise_error(Metar::ParseError, /Unparsable text found/)
368
+ end
369
+ end
370
+ end
331
371
  end
332
372
 
333
373
  context "#raw_attributes" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metar-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates