Class: Licensee::Matchers::Copyright
- Inherits:
-
Object
- Object
- Licensee::Matchers::Copyright
- Defined in:
- lib/licensee/matchers/copyright_matcher.rb
Constant Summary collapse
- COPYRIGHT_SYMBOLS =
rubocop:disable Metrics/LineLength
Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
- REGEX =
/^\s*#{COPYRIGHT_SYMBOLS}.*$/i
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #confidence ⇒ Object
-
#initialize(file) ⇒ Copyright
constructor
rubocop:enable Metrics/LineLength.
- #match ⇒ Object
Constructor Details
#initialize(file) ⇒ Copyright
rubocop:enable Metrics/LineLength
12 13 14 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 12 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 5 def file @file end |
Instance Method Details
#confidence ⇒ Object
25 26 27 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 25 def confidence 100 end |
#match ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/licensee/matchers/copyright_matcher.rb', line 16 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 |