Sha256: 00a22d52d5c39453786f9df3894554bb4ae72f92f8de020de37735bb00da2913
Contents?: true
Size: 745 Bytes
Versions: 4
Compression:
Stored size: 745 Bytes
Contents
# frozen_string_literal: true module Licensee module Matchers class Copyright < Licensee::Matchers::Matcher attr_reader :file 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 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 def confidence 100 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems