Class: I18nChecker::Locale::Files
- Inherits:
-
Object
- Object
- I18nChecker::Locale::Files
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/i18n_checker/locale/files.rb
Instance Method Summary collapse
-
#delete_if {|file| ... } ⇒ I18nChecker::Locale::Files
Execute the specified block and delete the translation file.
-
#initialize(locale_files = []) ⇒ Files
constructor
Translation files for each language.
- #to_h ⇒ Object
Constructor Details
#initialize(locale_files = []) ⇒ Files
Translation files for each language
15 16 17 |
# File 'lib/i18n_checker/locale/files.rb', line 15 def initialize(locale_files = []) @locale_files = locale_files end |
Instance Method Details
#delete_if {|file| ... } ⇒ I18nChecker::Locale::Files
Execute the specified block and delete the translation file
25 26 27 28 |
# File 'lib/i18n_checker/locale/files.rb', line 25 def delete_if(&block) locale_files.delete_if(&block) self end |
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/i18n_checker/locale/files.rb', line 30 def to_h all_locale_texts = {} locale_files.each do |locale_file| lang = locale_file.lang.to_s next all_locale_texts[lang] = nil if locale_file.empty? all_locale_texts[lang] = {} if !all_locale_texts.key?(lang) || all_locale_texts[lang].nil? locale_file.locale_texts.each do |k, v| next if all_locale_texts[lang].key?(k) all_locale_texts[lang][k] = v end end all_locale_texts end |