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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21aca2b78bc54f22390a57dbdef3550beeb2eb65e3407e8d4a518fedd62d23bf
4
- data.tar.gz: 8a08979ecb6f77b99928966ed1aaaec34a12048e22effd3c5924a2b6b1820317
3
+ metadata.gz: b281d6c55701570148a6e42577c6e981c23e2bdf6558dafc27aaa9c89dfdcc0d
4
+ data.tar.gz: 0e54a072a72fe7f2e5b76917766d044d945a44859b61cdc51247c3ac95f386b8
5
5
  SHA512:
6
- metadata.gz: a308d0af1aadb91ca19402bd61c4933da3555f774f78f4c6c1f9313ea150cf6f62f06c9245f01abaa832a8db5d102961a78e67b2e4e53f44c3110de21ff3c124
7
- data.tar.gz: 122f7b88eae3c8fe9f4943f49b6bbca6ee46bad15687d65725a88d8e01823b56d8ec7792973d19236bfb67d3f37756a5b88a565a26c863949c845ac6a5aba782
6
+ metadata.gz: 5ce44a6dcefcaf1ab262c3d2fd8593d8fabadeab5a5f4c167e6b921f4b66ebf96212bacab809c1765b4eba87a4adc58539449a1aad95cf5e381c87f3edb0326b
7
+ data.tar.gz: b8c0077f1eaa45fb89055431ab3807869acb7a87c8d4f6955bdbdd9364647cb13dea0bb36f4949f8a571e31d89dd1ce2215cec1c053265376995e229e962e5a7
data/.rubocop.yml CHANGED
@@ -14,6 +14,10 @@ Metrics/MethodLength:
14
14
  Metrics/BlockLength:
15
15
  Exclude:
16
16
  - spec/**/*
17
+ Metrics/CyclomaticComplexity:
18
+ Enabled: false
19
+ Metrics/PerceivedComplexity:
20
+ Enabled: false
17
21
  Style/HashEachMethods:
18
22
  Enabled: true
19
23
  Style/HashTransformKeys:
@@ -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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Biodiversity module provides a namespace for scientific name parser.
4
4
  module Biodiversity
5
- VERSION = '5.3.0'
5
+ VERSION = '5.3.1'
6
6
  GNPARSER_VERSION = 'GNparser 1.3.0+'
7
7
 
8
8
  def self.version
@@ -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
- ['Homo sapiens Linn.', 'Tobacco Mosaic Virus']
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin