mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Allow extensions without a leading dot
This makes the API a little easier to use.
This commit is contained in:
@@ -206,8 +206,12 @@ module Linguist
|
||||
# Language.find_by_extension('.rb')
|
||||
# # => [#<Language name="Ruby">]
|
||||
#
|
||||
# Language.find_by_extension('rb')
|
||||
# # => [#<Language name="Ruby">]
|
||||
#
|
||||
# Returns all matching Languages or [] if none were found.
|
||||
def self.find_by_extension(extname)
|
||||
extname = ".#{extname}" unless extname.start_with?(".")
|
||||
@extension_index[extname]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user