Module: LogStruct::KeyWords
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/config_struct/filters.rb
Overview
A key's words, lowercase and joined by underscores, so that keys match however they're written: apiKey, api-key, X-Api-Key and HTTP_X_API_KEY all contain "api_key"
Class Method Summary collapse
Class Method Details
.normalize(key) ⇒ String
13 14 15 16 17 18 19 |
# File 'lib/log_struct/config_struct/filters.rb', line 13 def self.normalize(key) key.to_s .gsub(/([a-z\d])([A-Z])/, '\1_\2') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .tr("- .", "___") .downcase end |