Class: I18n::Hygiene::KeyUsageChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n/hygiene/key_usage_checker.rb

Overview

Checks the usage of i18n keys in the codebase.

Instance Method Summary collapse

Constructor Details

#initialize(directories:, exclude_files: [], file_extensions: []) ⇒ KeyUsageChecker

Returns a new instance of KeyUsageChecker.



6
7
8
9
10
11
12
# File 'lib/i18n/hygiene/key_usage_checker.rb', line 6

def initialize(directories:, exclude_files: [], file_extensions: [])
  @directories = directories
  @exclude_files = exclude_files
  @file_extensions = file_extensions

  raise "Must have grep installed!" unless system("which grep > /dev/null")
end

Instance Method Details

#used?(key) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/i18n/hygiene/key_usage_checker.rb', line 14

def used?(key)
  fully_qualified_key_used?(key)
end