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

#initialize(locale, locale_dir_path) ⇒ KeyLister

Returns a new instance of KeyLister.



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

def initialize(locale, locale_dir_path)
  @locale = locale
  @source = YAML.load(File.open(File.expand_path("#{locale_dir_path}/#{locale}.yml")))
  @keys = Set[]
end

Class Method Details

.list_keys(locale: 'en', locale_dir_path: 'config/locales') ⇒ Object



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

def self.list_keys(locale: 'en', locale_dir_path: 'config/locales')
  KeyLister.new(locale, locale_dir_path).list_keys
end

Instance Method Details

#list_keysObject



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

def list_keys
  visit_childs(path: [])
  @keys
end