Class: Licensee::Project::LicenseFile
Instance Attribute Summary
Attributes inherited from File
#content, #filename
Class Method Summary
collapse
Instance Method Summary
collapse
#create_word_set
Methods inherited from File
#confidence, #initialize, #license, #matcher
Class Method Details
.name_score(filename) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/licensee/project_file.rb', line 48
def self.name_score(filename)
return 1.0 if filename =~ /\A(un)?licen[sc]e\z/i
return 0.9 if filename =~ /\A(un)?licen[sc]e\.(md|markdown|txt)\z/i
return 0.8 if filename =~ /\Acopy(ing|right)(\.[^.]+)?\z/i
return 0.7 if filename =~ /\A(un)?licen[sc]e\.[^.]+\z/i
return 0.5 if filename =~ /licen[sc]e/i
return 0.0
end
|
Instance Method Details
#attribution ⇒ Object
43
44
45
46
|
# File 'lib/licensee/project_file.rb', line 43
def attribution
matches = /^#{Matchers::Copyright::REGEX}$/i.match(content)
matches[0].strip if matches
end
|
#possible_matchers ⇒ Object
35
36
37
|
# File 'lib/licensee/project_file.rb', line 35
def possible_matchers
[Matchers::Copyright, Matchers::Exact, Matchers::Dice]
end
|
#wordset ⇒ Object
39
40
41
|
# File 'lib/licensee/project_file.rb', line 39
def wordset
@wordset ||= create_word_set(content)
end
|