lib/taxamatch_rb.rb in taxamatch_rb-0.6.1 vs lib/taxamatch_rb.rb in taxamatch_rb-0.6.2

- old
+ new

@@ -23,17 +23,17 @@ #takes two scientific names and returns true if names match and false if they don't def taxamatch(str1, str2, return_boolean = true) preparsed_1 = @parser.parse(str1) preparsed_2 = @parser.parse(str2) - match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil + match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue false return_boolean && match ? match['match'] : match end #takes two hashes of parsed scientific names, analyses them and returns back #this function is useful when species strings are preparsed. def taxamatch_preparsed(preparsed_1, preparsed_2) - result = nil + result = false result = match_uninomial(preparsed_1, preparsed_2) if preparsed_1[:uninomial] && preparsed_2[:uninomial] result = match_multinomial(preparsed_1, preparsed_2) if preparsed_1[:genus] && preparsed_2[:genus] if result && result['match'] result['match'] = match_authors(preparsed_1, preparsed_2) == 0 ? false : true end