Sha256: b73c81cd8aa91d0323b11eec3d2fad98fc33ed1a32ea3c808eb12143cc1a2071

Contents?: true

Size: 496 Bytes

Versions: 4

Compression:

Stored size: 496 Bytes

Contents

# encoding=utf-8
class 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

4 entries across 4 versions & 1 rubygems

Version Path
licensee-6.1.1 lib/licensee/matchers/copyright_matcher.rb
licensee-6.1.0 lib/licensee/matchers/copyright_matcher.rb
licensee-6.0.0 lib/licensee/matchers/copyright_matcher.rb
licensee-6.0.0b1 lib/licensee/matchers/copyright_matcher.rb