Merge branch 'master' into cpp_heuristic

Conflicts:
	lib/linguist/samples.json
This commit is contained in:
Arfon Smith
2013-12-22 19:25:01 -06:00
9 changed files with 1217 additions and 492 deletions

View File

@@ -1,6 +1,8 @@
module Linguist
# A collection of simple heuristics that can be used to better analyze languages.
class Heuristics
ACTIVE = false
# Public: Given an array of String language names,
# apply heuristics against the given data and return an array
# of matching languages, or nil.
@@ -10,8 +12,10 @@ module Linguist
#
# Returns an array of Languages or []
def self.find_by_heuristics(data, languages)
if languages.all? { |l| ["Objective-C", "C++"].include?(l) }
disambiguate_h(data, languages)
if active?
if languages.all? { |l| ["Objective-C", "C++"].include?(l) }
disambiguate_h(data, languages)
end
end
end
@@ -26,5 +30,9 @@ module Linguist
matches << Language["C++"] if data.include?("#include <cstdint>")
matches
end
def self.active?
!!ACTIVE
end
end
end