lib/linguist/heuristics.rb in github-linguist-7.30.0 vs lib/linguist/heuristics.rb in github-linguist-8.0.0

- old
+ new

@@ -124,11 +124,11 @@ end # Internal: Perform the heuristic def call(data) matched = @rules.find do |rule| - rule['pattern'].match(data) + rule['pattern'].match?(data) end if !matched.nil? languages = matched['language'] if languages.is_a?(Array) languages.map{ |l| Language[l] } @@ -143,29 +143,29 @@ def initialize(pats) @pats = pats end - def match(input) - return !@pats.any? { |pat| !pat.match(input) } + def match?(input) + return @pats.all? { |pat| pat.match?(input) } end end class AlwaysMatch - def match(input) + def match?(input) return true end end class NegativePattern def initialize(pat) @pat = pat end - def match(input) - return !@pat.match(input) + def match?(input) + return !@pat.match?(input) end end end