Sha256: 1fce3771599170d2890d329611d3f468a00b94996307345dc2cc3cc4860f0e89
Contents?: true
Size: 809 Bytes
Versions: 1
Compression:
Stored size: 809 Bytes
Contents
# frozen_string_literal: true module Coconductor module ProjectFiles class CodeOfConductFile < Coconductor::ProjectFiles::ProjectFile include Licensee::ContentHelper EXTENSIONS = %w[md markdown txt].freeze EXT_REGEX = /\.#{Regexp.union(EXTENSIONS)}/i.freeze BASENAME_REGEX = /(citizen[_-])?code[_-]of[_-]conduct/i.freeze # LANG_REGEX must contain extension to avoid matching .md as the lang LANG_REGEX = /(\.(?<lang>[a-z]{2}(-[a-z]{2})?)#{EXT_REGEX})?/i.freeze FILENAME_REGEX = /#{BASENAME_REGEX}#{LANG_REGEX}#{EXT_REGEX}?/i.freeze def self.name_score(filename) /\A#{FILENAME_REGEX}/.match?(filename) ? 1.0 : 0.0 end def possible_matchers [Matchers::Exact, Matchers::Dice, Matchers::FieldAware] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coconductor-0.10.0 | lib/coconductor/project_files/code_of_conduct_file.rb |