biodiversity 5.3.0 → 5.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 +4 -4
- data/.rubocop.yml +4 -0
- data/lib/biodiversity/parser.rb +5 -2
- data/lib/biodiversity/version.rb +1 -1
- data/spec/lib/parser_spec.rb +13 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b281d6c55701570148a6e42577c6e981c23e2bdf6558dafc27aaa9c89dfdcc0d
|
|
4
|
+
data.tar.gz: 0e54a072a72fe7f2e5b76917766d044d945a44859b61cdc51247c3ac95f386b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ce44a6dcefcaf1ab262c3d2fd8593d8fabadeab5a5f4c167e6b921f4b66ebf96212bacab809c1765b4eba87a4adc58539449a1aad95cf5e381c87f3edb0326b
|
|
7
|
+
data.tar.gz: b8c0077f1eaa45fb89055431ab3807869acb7a87c8d4f6955bdbdd9364647cb13dea0bb36f4949f8a571e31d89dd1ce2215cec1c053265376995e229e962e5a7
|
data/.rubocop.yml
CHANGED
data/lib/biodiversity/parser.rb
CHANGED
|
@@ -57,11 +57,14 @@ module Biodiversity
|
|
|
57
57
|
with_details, with_cultivars)
|
|
58
58
|
free_mem(ptr)
|
|
59
59
|
if simple
|
|
60
|
-
CSV.new(parsed).map do |row|
|
|
60
|
+
CSV.new(parsed.force_encoding('UTF-8')).map do |row|
|
|
61
61
|
csv_row(row)
|
|
62
62
|
end
|
|
63
63
|
else
|
|
64
|
-
JSON.parse(parsed, symbolize_names: true)
|
|
64
|
+
JSON.parse(parsed, symbolize_names: true).map do |item|
|
|
65
|
+
item[:parserVersion] = Biodiversity.gnparser_version
|
|
66
|
+
item
|
|
67
|
+
end
|
|
65
68
|
end
|
|
66
69
|
end
|
|
67
70
|
|
data/lib/biodiversity/version.rb
CHANGED
data/spec/lib/parser_spec.rb
CHANGED
|
@@ -49,18 +49,25 @@ describe Biodiversity::Parser do
|
|
|
49
49
|
describe('parse_ary') do
|
|
50
50
|
it 'parses names in simple format' do
|
|
51
51
|
parsed = subject.parse_ary(
|
|
52
|
-
['Homo sapiens Linn.', 'Pardosa moesta'],
|
|
53
|
-
simple: true
|
|
52
|
+
['Homo sapiens Linn.', 'Pardosa moesta', 'Aus bus "White Russian"'],
|
|
53
|
+
simple: true, with_cultivars: true
|
|
54
54
|
)
|
|
55
55
|
expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
|
|
56
56
|
expect(parsed[0][:normalized]).to be_nil
|
|
57
57
|
|
|
58
58
|
expect(parsed[1][:canonical][:simple]).to eq 'Pardosa moesta'
|
|
59
|
+
expect(parsed[2][:canonical][:simple]).to eq 'Aus bus ‘White Russian’'
|
|
60
|
+
expect(parsed[2][:quality]).to eq 1
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
it 'parsed name in full format' do
|
|
62
64
|
parsed = subject.parse_ary(
|
|
63
|
-
[
|
|
65
|
+
[
|
|
66
|
+
'Homo sapiens Linn.',
|
|
67
|
+
'Tobacco Mosaic Virus',
|
|
68
|
+
"Aus bus 'White Russian'"
|
|
69
|
+
],
|
|
70
|
+
with_cultivars: true
|
|
64
71
|
)
|
|
65
72
|
expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
|
|
66
73
|
expect(parsed[0][:normalized]).to eq 'Homo sapiens Linn.'
|
|
@@ -68,6 +75,9 @@ describe Biodiversity::Parser do
|
|
|
68
75
|
expect(parsed[1][:parsed]).to be false
|
|
69
76
|
expect(parsed[1][:virus]).to be true
|
|
70
77
|
expect(parsed[1][:words]).to be_nil
|
|
78
|
+
expect(parsed[2][:canonical][:simple]).to eq 'Aus bus ‘White Russian’'
|
|
79
|
+
expect(parsed[2][:quality]).to eq 1
|
|
80
|
+
expect(parsed[2][:parserVersion]).to match(/GNparser/)
|
|
71
81
|
end
|
|
72
82
|
end
|
|
73
83
|
end
|