Class: Licensee::Matchers::Copyright
- Defined in:
- lib/licensee/matchers/copyright.rb
Constant Summary collapse
- COPYRIGHT_SYMBOLS =
rubocop:disable Layout/LineLength
Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
- REGEX =
/#{ContentHelper::START_REGEX}(?:portions )?(\s*#{COPYRIGHT_SYMBOLS}.*$)+$/i.freeze
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 Layout/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.
6 7 8 |
# File 'lib/licensee/matchers/copyright.rb', line 6 def file @file end |
Instance Method Details
#confidence ⇒ Object
22 23 24 |
# File 'lib/licensee/matchers/copyright.rb', line 22 def confidence 100 end |
#match ⇒ Object
rubocop:enable Layout/LineLength
13 14 15 16 17 18 19 20 |
# File 'lib/licensee/matchers/copyright.rb', line 13 def match # Note: must use content, and not content_normalized here if file.content.strip =~ /#{REGEX}+\z/i Licensee::License.find('no-license') end rescue Encoding::CompatibilityError nil end |