Module: Rubydex::Severity
- Defined in:
- lib/rubydex/severity.rb
Defined Under Namespace
Classes: Base, Error, Hint, Information, Warning
Constant Summary collapse
- ALL =
All severities order based on their importance.
[Error, Warning, Information, Hint].freeze
- VALUE_MAP =
: Hash[Symbol, singleton(Base)]
ALL.to_h { |severity| [severity.value, severity] }.freeze
Class Method Summary collapse
-
.from_value(value) ⇒ Object
: (Symbol) -> singleton(Base).
Class Method Details
.from_value(value) ⇒ Object
: (Symbol) -> singleton(Base)
62 63 64 65 66 67 |
# File 'lib/rubydex/severity.rb', line 62 def from_value(value) severity = VALUE_MAP[value] return severity if severity raise ArgumentError, "Invalid severity #{value.inspect}. Expected one of: #{VALUE_MAP.keys.join(", ")}" end |