Class: I18nChecker::Command::Clean
- Inherits:
-
Object
- Object
- I18nChecker::Command::Clean
- Defined in:
- lib/i18n_checker/command/clean.rb
Instance Method Summary collapse
-
#initialize(locale_file_paths: [], source_paths: [], reporter:) ⇒ Clean
constructor
A new instance of Clean.
- #run {|unused_result| ... } ⇒ Object
Constructor Details
#initialize(locale_file_paths: [], source_paths: [], reporter:) ⇒ Clean
Returns a new instance of Clean.
6 7 8 9 10 11 |
# File 'lib/i18n_checker/command/clean.rb', line 6 def initialize(locale_file_paths: [], source_paths: [], reporter:) @reporter = reporter @locale_texts = I18nChecker::Locale.texts_of(source_paths) @locale_files = I18nChecker::Locale.load_of(locale_file_paths) @unused_detector = I18nChecker::Unused::Detector.new(@locale_files) end |
Instance Method Details
#run {|unused_result| ... } ⇒ Object
13 14 15 16 17 18 |
# File 'lib/i18n_checker/command/clean.rb', line 13 def run unused_result = @locale_texts.detect(@unused_detector) @reporter.report unused_result unused_result.apply(@locale_files) yield unused_result if block_given? end |