taxamatch_rb 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/taxamatch_rb.rb +3 -3
- data/spec/taxamatch_rb_spec.rb +1 -0
- metadata +2 -2
data/lib/taxamatch_rb.rb
CHANGED
@@ -25,14 +25,14 @@ module Taxamatch
|
|
25
25
|
def taxamatch(str1, str2, return_boolean = true)
|
26
26
|
preparsed_1 = @parser.parse(str1)
|
27
27
|
preparsed_2 = @parser.parse(str2)
|
28
|
-
match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue
|
29
|
-
return_boolean
|
28
|
+
match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil
|
29
|
+
return_boolean ? (!!match && match['match']) : match
|
30
30
|
end
|
31
31
|
|
32
32
|
#takes two hashes of parsed scientific names, analyses them and returns back
|
33
33
|
#this function is useful when species strings are preparsed.
|
34
34
|
def taxamatch_preparsed(preparsed_1, preparsed_2)
|
35
|
-
result =
|
35
|
+
result = nil
|
36
36
|
result = match_uninomial(preparsed_1, preparsed_2) if preparsed_1[:uninomial] && preparsed_2[:uninomial]
|
37
37
|
result = match_multinomial(preparsed_1, preparsed_2) if preparsed_1[:genus] && preparsed_2[:genus]
|
38
38
|
if result && result['match']
|
data/spec/taxamatch_rb_spec.rb
CHANGED