Class: Licensee::Matchers::Reference

Inherits:
Matcher
  • Object
show all
Defined in:
lib/licensee/matchers/reference.rb

Overview

Matches README files that include a license by reference

Constant Summary

Constants inherited from Matcher

Matcher::HASH_METHODS

Instance Attribute Summary

Attributes inherited from Matcher

#file

Instance Method Summary collapse

Methods inherited from Matcher

#initialize, #name

Methods included from HashHelper

#to_h

Constructor Details

This class inherits a constructor from Licensee::Matchers::Matcher

Instance Method Details

#confidenceObject



14
15
16
# File 'lib/licensee/matchers/reference.rb', line 14

def confidence
  90
end

#matchObject



7
8
9
10
11
12
# File 'lib/licensee/matchers/reference.rb', line 7

def match
  potential_matches.find do |license|
    title_or_source = [license.title_regex, license.source_regex].compact
    /\b#{Regexp.union(title_or_source)}\b/ =~ file.content
  end
end