Class: Ember::I18n::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/ember/i18n/engine.rb

Constant Summary collapse

I18N_TRANSLATIONS_ASSET =
"i18n/translations"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cached_load_path_hashObject

Returns the value of attribute cached_load_path_hash.



59
60
61
# File 'lib/ember/i18n/engine.rb', line 59

def cached_load_path_hash
  @cached_load_path_hash
end

Class Method Details

.load_path_hash_cacheObject



37
38
39
# File 'lib/ember/i18n/engine.rb', line 37

def self.load_path_hash_cache
  @load_path_hash_cache ||= Rails.root.join("tmp/ember-i18n.cache")
end

.write_hash!Object



50
51
52
53
54
55
56
# File 'lib/ember/i18n/engine.rb', line 50

def self.write_hash!
  FileUtils.mkdir_p Rails.root.join("tmp")

  File.open(load_path_hash_cache, "w+") do |f|
    f.write(cached_load_path_hash)
  end
end

.write_hash_if_changedObject



41
42
43
44
45
46
47
48
# File 'lib/ember/i18n/engine.rb', line 41

def self.write_hash_if_changed
  load_path_hash = ::I18n.load_path.hash

  if load_path_hash != cached_load_path_hash
    self.cached_load_path_hash = load_path_hash
    write_hash!
  end
end