Module: Julewire::Core::Records::RawInput
- Defined in:
- lib/julewire/core/records/raw_input.rb
Class Method Summary collapse
- .explicit_severity?(input) ⇒ Boolean
- .hash_input?(input) ⇒ Boolean
- .severity_key?(key) ⇒ Boolean
- .value(input, key, default: nil) ⇒ Object
- .without_severity_keys(input) ⇒ Object
Class Method Details
.explicit_severity?(input) ⇒ Boolean
14 15 16 |
# File 'lib/julewire/core/records/raw_input.rb', line 14 def explicit_severity?(input) hash_input?(input) && (input.key?(SEVERITY_KEY) || input.key?(SEVERITY_STRING_KEY)) end |
.hash_input?(input) ⇒ Boolean
34 35 36 |
# File 'lib/julewire/core/records/raw_input.rb', line 34 def hash_input?(input) input.is_a?(Hash) || LazyEmitInput.input?(input) end |
.severity_key?(key) ⇒ Boolean
18 19 20 |
# File 'lib/julewire/core/records/raw_input.rb', line 18 def severity_key?(key) SEVERITY_KEYS.include?(key) end |
.value(input, key, default: nil) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/julewire/core/records/raw_input.rb', line 26 def value(input, key, default: nil) return default unless hash_input?(input) return input[key] if input.key?(key) return input[key.to_s] if input.key?(key.to_s) default end |
.without_severity_keys(input) ⇒ Object
22 23 24 |
# File 'lib/julewire/core/records/raw_input.rb', line 22 def without_severity_keys(input) input.except(*SEVERITY_KEYS) end |