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 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 false
29
- return_boolean && match ? match['match'] : match
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 = false
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']
@@ -180,6 +180,7 @@ describe 'Taxamatch::Base' do
180
180
 
181
181
  it 'should return only boolean values' do
182
182
  @tm.taxamatch("AJLJljljlj", "sls").should_not be_nil
183
+ @tm.taxamatch('Olsl','a')
183
184
  end
184
185
 
185
186
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 2
9
- version: 0.6.2
8
+ - 3
9
+ version: 0.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dmitry Mozzherin