Class: Licensee::Matchers::Copyright
- Inherits:
-
Object
- Object
- Licensee::Matchers::Copyright
- Defined in:
- lib/licensee/matchers/copyright_matcher.rb
Constant Summary collapse
- REGEX =
/\s*Copyright (©|\(c\)|\xC2\xA9)? ?(\d{4}|\[year\])(.*)?\s*/i
Instance Method Summary collapse
- #confidence ⇒ Object
-
#initialize(file) ⇒ Copyright
constructor
A new instance of Copyright.
- #match ⇒ Object
Constructor Details
#initialize(file) ⇒ Copyright
Returns a new instance of Copyright.
7 8 9 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 7 def initialize(file) @file = file end |
Instance Method Details
#confidence ⇒ Object
20 21 22 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 20 def confidence 100 end |
#match ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 11 def match # Note: must use content, and not content_normalized here if @file.content.strip =~ /\A#{REGEX}\z/i Licensee::License.find('no-license') end rescue nil end |