Class: I18n::Coverage::KeyLister

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n/coverage/key_lister.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeyLister

Returns a new instance of KeyLister.



10
11
12
13
14
# File 'lib/i18n/coverage/key_lister.rb', line 10

def initialize
  locale_dir_path = I18n::Coverage.config.locale_dir_path
  @locale_files = Dir.glob("#{locale_dir_path}/**/*.yml")
  @keys = Set[]
end

Class Method Details

.list_keysObject



6
7
8
# File 'lib/i18n/coverage/key_lister.rb', line 6

def self.list_keys
  KeyLister.new.list_keys
end

Instance Method Details

#list_keysObject



16
17
18
19
20
21
22
# File 'lib/i18n/coverage/key_lister.rb', line 16

def list_keys
  @locale_files
    .map(&YAML.method(:load_file))
    .flat_map { |hash| visit_childs(source: hash, path: []) }

  @keys
end