lib/licensee/matchers/levenshtein_matcher.rb in licensee-5.0.0b7 vs lib/licensee/matchers/levenshtein_matcher.rb in licensee-5.0.0
- old
+ new
@@ -1,10 +1,11 @@
class Licensee
class LevenshteinMatcher < Matcher
# Return the first potential license that is more similar than the confidence threshold
def match
- @match ||= potential_licenses.find do |license|
+ return @match if defined? @match
+ @match = potential_licenses.find do |license|
# If we know the license text contains the license name or nickname,
# bail early unless the file we're checking contains it.
# Guards against OSL & AFL confusion. See https://github.com/benbalter/licensee/issues/50
next if license.body_includes_name? && !includes_license_name?(license)