class I18nChecker::NotFound::Detector
Public Class Methods
new(locale_files)
click to toggle source
# File lib/i18n_checker/not_found/detector.rb, line 4 def initialize(locale_files) @locale_texts = locale_files.to_h end
Public Instance Methods
detect(locale_texts)
click to toggle source
# File lib/i18n_checker/not_found/detector.rb, line 8 def detect(locale_texts) results = locale_texts.map { |local_text| detect_not_found(local_text) } Result.new(results.compact.flatten) end
Private Instance Methods
detect_not_found(locale_text)
click to toggle source
# File lib/i18n_checker/not_found/detector.rb, line 15 def detect_not_found(locale_text) not_founds = @locale_texts.reject do |_lang, texts| next false if texts.nil? texts.key?(locale_text.text) end not_founds.keys.map do |not_found_lang| Text.new( lang: not_found_lang.to_sym, locale_text: locale_text, ) end end