mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-02-12 11:19:31 +00:00
Extract empty blob strategy
This commit is contained in:
10
lib/linguist/strategy/empty_blob.rb
Normal file
10
lib/linguist/strategy/empty_blob.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module Linguist
|
||||
module Strategy
|
||||
class EmptyBlob
|
||||
def self.call(blob, langauges)
|
||||
# Don't bother with binary contents or an empty file
|
||||
[] if blob.data.nil? || blob.data == ""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
module Linguist
|
||||
module Strategy
|
||||
# Check if there's a shebang line and use that as authoritative
|
||||
class Shebang
|
||||
def self.call(blob, _)
|
||||
Language.find_by_shebang(blob.data)
|
||||
|
||||
Reference in New Issue
Block a user