Files
linguist/lib/linguist/strategy/filename.rb
Paul Chaignon 9b941a34f0 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
2016-12-12 12:34:33 -08:00

12 lines
221 B
Ruby

module Linguist
module Strategy
# Detects language based on filename
class Filename
def self.call(blob, _)
name = blob.name.to_s
Language.find_by_filename(name)
end
end
end
end