Sha256: c75e9056ba509a4490342612e803987258841b0e37a10117ff424c63c1c56dea
Contents?: true
Size: 608 Bytes
Versions: 17
Compression:
Stored size: 608 Bytes
Contents
module Linguist module Strategy # Detects language based on filename and/or extension class Filename def self.call(blob, _) name = blob.name.to_s # A bit of an elegant hack. If the file is executable but extensionless, # append a "magic" extension so it can be classified with other # languages that have shebang scripts. extensions = FileBlob.new(name).extensions if extensions.empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05 name += ".script!" end Language.find_by_filename(name) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems