Class: I18nChecker::Command::UnusedCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_checker/command/unused_check.rb

Instance Method Summary collapse

Constructor Details

#initialize(locale_file_paths: [], source_paths: [], reporter:) ⇒ UnusedCheck

Returns a new instance of UnusedCheck.



6
7
8
9
10
11
# File 'lib/i18n_checker/command/unused_check.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

Yields:

  • (unused_result)


13
14
15
16
17
# File 'lib/i18n_checker/command/unused_check.rb', line 13

def run
  unused_result = @locale_texts.detect(@unused_detector)
  @reporter.report unused_result
  yield unused_result if block_given?
end