Class: Lit::Services::HumanizeService
- Inherits:
-
Object
- Object
- Lit::Services::HumanizeService
- Defined in:
- lib/lit/services/humanize_service.rb
Overview
Checks if should humanize based on config and blacklist. Performs humanize if required Caches the value of humanization
Class Method Summary collapse
Class Method Details
.humanize(key) ⇒ Object
13 14 15 |
# File 'lib/lit/services/humanize_service.rb', line 13 def self.humanize(key) key.to_s.split('.').last.humanize end |
.humanize_and_cache(key, options) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/lit/services/humanize_service.rb', line 17 def self.humanize_and_cache(key, ) content = humanize(key) parts = I18n.normalize_keys( [:locale] || I18n.locale, key, [:scope], [:separator] ) key_with_locale = parts.join('.') I18n.cache_store[key_with_locale] = content I18n.cache_store[key_with_locale] end |