Class: ForemanThemeSatellite::ReplacerRepository
- Inherits:
-
FastGettext::TranslationRepository::Base
- Object
- FastGettext::TranslationRepository::Base
- ForemanThemeSatellite::ReplacerRepository
- Defined in:
- lib/foreman_theme_satellite/replacer_repository.rb
Overview
This repository is a wrapper above other repository, it replaces branded words with their downstream counterparts.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #available_locales ⇒ Object
-
#initialize(old_repo) ⇒ ReplacerRepository
constructor
A new instance of ReplacerRepository.
- #plural(*keys) ⇒ Object
- #pluralisation_rule ⇒ Object
- #reload ⇒ Object
Constructor Details
#initialize(old_repo) ⇒ ReplacerRepository
Returns a new instance of ReplacerRepository.
7 8 9 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 7 def initialize(old_repo) @repo = old_repo end |
Instance Method Details
#[](key) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 19 def [](key) original = @repo[key] val = original || key return original unless val.is_a? String val = val.dup if val replaced = replace_string(val) replaced == val ? original : replaced end |
#available_locales ⇒ Object
15 16 17 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 15 def available_locales @repo.available_locales end |
#plural(*keys) ⇒ Object
31 32 33 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 31 def plural(*keys) @repo.plural(*keys) end |
#pluralisation_rule ⇒ Object
11 12 13 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 11 def pluralisation_rule @repo.pluralisation_rule end |
#reload ⇒ Object
35 36 37 |
# File 'lib/foreman_theme_satellite/replacer_repository.rb', line 35 def reload @repo.reload end |