Sha256: 83fcdf7835473b2f592cd1ede9042157c30442322ef59fba1247b6e6b7b458c4

Contents?: true

Size: 457 Bytes

Versions: 4

Compression:

Stored size: 457 Bytes

Contents

# encoding=utf-8
class Licensee
  class CopyrightMatcher < Matcher

    REGEX = /\s*Copyright (©|\(c\)|\xC2\xA9)? ?(\d{4}|\[year\])(.*)?\s*/i

    def match
      # Note: must use content, and not content_normalized here
      no_license if file.content.strip =~ /\A#{REGEX}\z/i
    rescue
      nil
    end

    def confidence
      100
    end

    private

    def no_license
      @no_license ||= Licensee::License.find("no-license")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
licensee-5.0.0 lib/licensee/matchers/copyright_matcher.rb
licensee-5.0.0b7 lib/licensee/matchers/copyright_matcher.rb
licensee-5.0.0b6 lib/licensee/matchers/copyright_matcher.rb
licensee-5.0.0b5 lib/licensee/matchers/copyright_matcher.rb