mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Change Classifier to accept language name Strings
This commit is contained in:
@@ -439,10 +439,10 @@ module Linguist
|
||||
# Returns a Language or nil.
|
||||
def disambiguate_extension_language
|
||||
if Language.ambiguous?(extname)
|
||||
possible_languages = Language.all.select { |l| l.extensions.include?(extname) }
|
||||
possible_languages = Language.all.select { |l| l.extensions.include?(extname) }.map(&:name)
|
||||
if possible_languages.any?
|
||||
if result = Classifier.instance.classify(data, possible_languages).first
|
||||
result[0]
|
||||
Language[result[0]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user