mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Use filenames as a definitive answer (#2006)
* Separate find_by_extension and find_by_filename find_by_extension now takes a path as argument and not only the file extension. Currently only find_by_extension is used as a strategy. * Add find_by_filename as first strategy
This commit is contained in:
committed by
Brandon Black
parent
9d8392dab8
commit
9b941a34f0
@@ -1,9 +1,10 @@
|
||||
module Linguist
|
||||
module Strategy
|
||||
# Detects language based on filename and/or extension
|
||||
# Detects language based on filename
|
||||
class Filename
|
||||
def self.call(blob, _)
|
||||
Language.find_by_filename(blob.name.to_s)
|
||||
name = blob.name.to_s
|
||||
Language.find_by_filename(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user