Class: Licensee::Matchers::Copyright
- Defined in:
- lib/licensee/matchers/copyright.rb
Constant Summary collapse
- COPYRIGHT_SYMBOLS =
rubocop:disable Metrics/LineLength
Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
- REGEX =
/\A(\s*#{COPYRIGHT_SYMBOLS}.*$)+/i
Constants inherited from Matcher
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #confidence ⇒ Object
-
#match ⇒ Object
rubocop:enable Metrics/LineLength.
Methods inherited from Matcher
Methods included from HashHelper
Constructor Details
This class inherits a constructor from Licensee::Matchers::Matcher
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/licensee/matchers/copyright.rb', line 4 def file @file end |
Instance Method Details
#confidence ⇒ Object
20 21 22 |
# File 'lib/licensee/matchers/copyright.rb', line 20 def confidence 100 end |
#match ⇒ Object
rubocop:enable Metrics/LineLength
11 12 13 14 15 16 17 18 |
# File 'lib/licensee/matchers/copyright.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 Encoding::CompatibilityError nil end |