Merge pull request #2535 from pchaigno/heuristics-case-insensitive

Case-insensitive extension match for heuristic rules
This commit is contained in:
Arfon Smith
2015-08-04 21:35:54 +01:00

View File

@@ -56,7 +56,7 @@ module Linguist
# Internal: Check if this heuristic matches the candidate languages. # Internal: Check if this heuristic matches the candidate languages.
def matches?(filename) def matches?(filename)
@extensions.any? { |ext| filename.end_with?(ext) } @extensions.any? { |ext| filename.downcase.end_with?(ext) }
end end
# Internal: Perform the heuristic # Internal: Perform the heuristic
@@ -351,7 +351,7 @@ module Linguist
end end
end end
disambiguate ".r", ".R" do |data| disambiguate ".r" do |data|
if /\bRebol\b/i.match(data) if /\bRebol\b/i.match(data)
Language["Rebol"] Language["Rebol"]
elsif data.include?("<-") elsif data.include?("<-")