Class: Licensee::Matchers::Copyright
- Defined in:
- lib/licensee/matchers/copyright.rb
Constant Summary collapse
- COPYRIGHT_SYMBOLS =
Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
- MAIN_LINE_REGEX =
/[_*\-\s]*#{COPYRIGHT_SYMBOLS}.*$/i
- OPTIONAL_LINE_REGEX =
/[_*\-\s]*with Reserved Font Name.*$/i
- REGEX =
/#{ContentHelper::START_REGEX}(#{MAIN_LINE_REGEX}#{OPTIONAL_LINE_REGEX}*)+$/i
Constants inherited from Matcher
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
Methods inherited from Matcher
Methods included from HashHelper
Constructor Details
This class inherits a constructor from Licensee::Matchers::Matcher
Instance Attribute Details
permalink #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
permalink #confidence ⇒ Object
[View source]
19 20 21 |
# File 'lib/licensee/matchers/copyright.rb', line 19 def confidence 100 end |
permalink #match ⇒ Object
[View source]
12 13 14 15 16 17 |
# File 'lib/licensee/matchers/copyright.rb', line 12 def match # NOTE: must use content, and not content_normalized here Licensee::License.find('no-license') if /#{REGEX}+\z/io.match?(file.content.strip) rescue Encoding::CompatibilityError nil end |