mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge remote-tracking branch 'origin/master' into move-shebang
* origin/master: Tweak docs
This commit is contained in:
@@ -110,16 +110,16 @@ module Linguist
|
|||||||
# Bail early if the blob is binary or empty.
|
# Bail early if the blob is binary or empty.
|
||||||
return nil if blob.likely_binary? || blob.binary? || blob.empty?
|
return nil if blob.likely_binary? || blob.binary? || blob.empty?
|
||||||
|
|
||||||
# Call each strategy until one candidate is returned
|
# Call each strategy until one candidate is returned.
|
||||||
STRATEGIES.reduce([]) do |languages, strategy|
|
STRATEGIES.reduce([]) do |languages, strategy|
|
||||||
candidates = strategy.call(blob, languages)
|
candidates = strategy.call(blob, languages)
|
||||||
if candidates.size == 1
|
if candidates.size == 1
|
||||||
return candidates.first
|
return candidates.first
|
||||||
elsif candidates.size > 1
|
elsif candidates.size > 1
|
||||||
# More than one candidate was found, pass them to the next strategy
|
# More than one candidate was found, pass them to the next strategy.
|
||||||
candidates
|
candidates
|
||||||
else
|
else
|
||||||
# Strategy couldn't find any candidates, so pass on the original list
|
# No candiates were found, pass on languages from the previous strategy.
|
||||||
languages
|
languages
|
||||||
end
|
end
|
||||||
end.first
|
end.first
|
||||||
|
|||||||
Reference in New Issue
Block a user