mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Make it safe to pass nil to Language.find_by_name/alias again
This restores compatibility with v3.4.x.
This commit is contained in:
@@ -164,7 +164,7 @@ module Linguist
|
||||
#
|
||||
# Returns the Language or nil if none was found.
|
||||
def self.find_by_name(name)
|
||||
@name_index[name.downcase]
|
||||
name && @name_index[name.downcase]
|
||||
end
|
||||
|
||||
# Public: Look up Language by one of its aliases.
|
||||
@@ -178,7 +178,7 @@ module Linguist
|
||||
#
|
||||
# Returns the Lexer or nil if none was found.
|
||||
def self.find_by_alias(name)
|
||||
@alias_index[name.downcase]
|
||||
name && @alias_index[name.downcase]
|
||||
end
|
||||
|
||||
# Public: Look up Languages by filename.
|
||||
@@ -243,7 +243,7 @@ module Linguist
|
||||
#
|
||||
# Returns the Language or nil if none was found.
|
||||
def self.[](name)
|
||||
@index[name.downcase]
|
||||
name && @index[name.downcase]
|
||||
end
|
||||
|
||||
# Public: A List of popular languages
|
||||
|
||||
Reference in New Issue
Block a user