biodiversity 5.1.0 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/biodiversity/parser.rb +4 -4
- data/lib/biodiversity/version.rb +1 -1
- data/spec/lib/parser_spec.rb +5 -1
- 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: 04ea2a69ec867a904293aaaf7c482970c7f456d5025b103e6e45ce6ff89a686e
|
4
|
+
data.tar.gz: 14b251bb4b841f2916151002e8ed4718ef8732b771069a1543ab1b0c0402585d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9addd540eb74d8bfdc3d851fc2a277e9bc613b588dc12b22ccfcb59b901ac16293297d464f7e56c09b3dd6ecdf3412e95954fcf7eda7bc9bdcb816006f36a898
|
7
|
+
data.tar.gz: 36364f23418870c90578a6ffd779faeff07d2cee2cb9f2b3c6e6dd1e03c925e93c6fabc3fc7191c55bcc1d27ee1b5bb1ac3968bca4ed7a112503aa5abaf771fe
|
data/lib/biodiversity/parser.rb
CHANGED
@@ -33,18 +33,18 @@ module Biodiversity
|
|
33
33
|
%i[pointer int string int], :strptr)
|
34
34
|
attach_function(:free_mem, :FreeMemory, %i[pointer], :void)
|
35
35
|
|
36
|
-
def self.parse(name, simple: false
|
36
|
+
def self.parse(name, simple: false)
|
37
37
|
format = simple ? 'csv' : 'compact'
|
38
|
-
with_details =
|
38
|
+
with_details = simple ? 0 : 1
|
39
39
|
|
40
40
|
parsed, ptr = parse_go(name, format, with_details)
|
41
41
|
free_mem(ptr)
|
42
42
|
output(parsed, simple)
|
43
43
|
end
|
44
44
|
|
45
|
-
def self.parse_ary(ary, simple: false
|
45
|
+
def self.parse_ary(ary, simple: false)
|
46
46
|
format = simple ? 'csv' : 'compact'
|
47
|
-
with_details =
|
47
|
+
with_details = simple ? 0 : 1
|
48
48
|
|
49
49
|
in_ptr = FFI::MemoryPointer.new(:pointer, ary.length)
|
50
50
|
in_ptr.write_array_of_pointer(
|
data/lib/biodiversity/version.rb
CHANGED
data/spec/lib/parser_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Biodiversity::Parser do
|
|
14
14
|
parsed = subject.parse('Homo sapiens Linn.')
|
15
15
|
expect(parsed[:canonical][:simple]).to eq 'Homo sapiens'
|
16
16
|
expect(parsed[:normalized]).to eq 'Homo sapiens Linn.'
|
17
|
+
expect(parsed[:words].size).to eq 3
|
17
18
|
end
|
18
19
|
|
19
20
|
it 'gets quality and year correctly in simple form' do
|
@@ -32,8 +33,9 @@ describe Biodiversity::Parser do
|
|
32
33
|
simple: true
|
33
34
|
)
|
34
35
|
expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
|
35
|
-
expect(parsed[1][:canonical][:simple]).to eq 'Pardosa moesta'
|
36
36
|
expect(parsed[0][:normalized]).to be_nil
|
37
|
+
|
38
|
+
expect(parsed[1][:canonical][:simple]).to eq 'Pardosa moesta'
|
37
39
|
end
|
38
40
|
|
39
41
|
it 'parsed name in full format' do
|
@@ -42,8 +44,10 @@ describe Biodiversity::Parser do
|
|
42
44
|
)
|
43
45
|
expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
|
44
46
|
expect(parsed[0][:normalized]).to eq 'Homo sapiens Linn.'
|
47
|
+
expect(parsed[0][:words].size).to eq 3
|
45
48
|
expect(parsed[1][:parsed]).to be false
|
46
49
|
expect(parsed[1][:virus]).to be true
|
50
|
+
expect(parsed[1][:words]).to be_nil
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|