mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Use Enum.parse
This commit is contained in:
parent
117e100855
commit
f1fe34f8b9
1 changed files with 3 additions and 10 deletions
|
@ -21,16 +21,9 @@ module Ameba
|
|||
# ```
|
||||
#
|
||||
def self.from_name(name : String)
|
||||
case name.downcase
|
||||
when "error"
|
||||
Error
|
||||
when "warning"
|
||||
Warning
|
||||
when "refactoring"
|
||||
Refactoring
|
||||
else
|
||||
raise "Incorrect severity name #{name}. Try one of #{Severity.values}"
|
||||
end
|
||||
parse(name)
|
||||
rescue ArgumentError
|
||||
raise "Incorrect severity name #{name}. Try one of #{Severity.values}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue