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,18 +21,11 @@ module Ameba
|
||||||
# ```
|
# ```
|
||||||
#
|
#
|
||||||
def self.from_name(name : String)
|
def self.from_name(name : String)
|
||||||
case name.downcase
|
parse(name)
|
||||||
when "error"
|
rescue ArgumentError
|
||||||
Error
|
|
||||||
when "warning"
|
|
||||||
Warning
|
|
||||||
when "refactoring"
|
|
||||||
Refactoring
|
|
||||||
else
|
|
||||||
raise "Incorrect severity name #{name}. Try one of #{Severity.values}"
|
raise "Incorrect severity name #{name}. Try one of #{Severity.values}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Converter for `YAML.mapping` which converts severity enum to and from YAML.
|
# Converter for `YAML.mapping` which converts severity enum to and from YAML.
|
||||||
class SeverityYamlConverter
|
class SeverityYamlConverter
|
||||||
|
|
Loading…
Reference in a new issue