Class: I18nChecker::Unused::Detector
- Inherits:
-
Object
- Object
- I18nChecker::Unused::Detector
- Defined in:
- lib/i18n_checker/unused/detector.rb
Instance Method Summary collapse
- #detect(locale_texts) ⇒ Object
-
#initialize(locale_files) ⇒ Detector
constructor
A new instance of Detector.
Constructor Details
#initialize(locale_files) ⇒ Detector
Returns a new instance of Detector.
7 8 9 |
# File 'lib/i18n_checker/unused/detector.rb', line 7 def initialize(locale_files) @locale_files = locale_files end |
Instance Method Details
#detect(locale_texts) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/i18n_checker/unused/detector.rb', line 11 def detect(locale_texts) unused_texts = cleaned_locale_files(locale_texts).map do |locale_file| locale_file.locale_texts.map do |key, _v| I18nChecker::Unused::Text.new( text: key, file: locale_file, ) end end I18nChecker::Unused::Result.new(unused_texts.compact.flatten) end |