Sha256: acd963b6372972dfecc0bd7cf8ce02c4fb8ac8672874f5042b4f2f5d16454575
Contents?: true
Size: 840 Bytes
Versions: 27
Compression:
Stored size: 840 Bytes
Contents
module Datadog module CI module Codeowners class Rule attr_reader :pattern, :owners def initialize(pattern, owners) @pattern = pattern @owners = owners end def match?(file_path) res = false # if pattern does not end with a separator or a wildcard, it could be either a directory or a file if !pattern.end_with?(::File::SEPARATOR, "*") directory_pattern = "#{pattern}#{::File::SEPARATOR}*" res ||= File.fnmatch?(directory_pattern, file_path, flags) end res ||= File.fnmatch?(pattern, file_path, flags) res end private def flags return ::File::FNM_PATHNAME if pattern.end_with?("#{::File::SEPARATOR}*") 0 end end end end end
Version data entries
27 entries across 27 versions & 1 rubygems