Sha256: dc95b4c77e1b9717dc4eab0fcfd04eab430ea71986cb310c01e47d8b42e419c6

Contents?: true

Size: 496 Bytes

Versions: 7

Compression:

Stored size: 496 Bytes

Contents

# encoding=utf-8
module Licensee
  module Matchers
    class Copyright
      REGEX = /\s*Copyright (©|\(c\)|\xC2\xA9)? ?(\d{4}|\[year\])(.*)?\s*/i

      def initialize(file)
        @file = file
      end

      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
        nil
      end

      def confidence
        100
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
licensee-8.3.1 lib/licensee/matchers/copyright_matcher.rb
licensee-8.3.0 lib/licensee/matchers/copyright_matcher.rb
licensee-8.2.0 lib/licensee/matchers/copyright_matcher.rb
licensee-8.1.0 lib/licensee/matchers/copyright_matcher.rb
licensee-8.0.0 lib/licensee/matchers/copyright_matcher.rb
licensee-7.0.1 lib/licensee/matchers/copyright_matcher.rb
licensee-7.0.0 lib/licensee/matchers/copyright_matcher.rb