Class: I18n::MissingTranslations
- Inherits:
-
Object
- Object
- I18n::MissingTranslations
- Defined in:
- lib/i18n/missing_translations.rb,
lib/i18n/missing_translations/log.rb,
lib/i18n/missing_translations/handler.rb,
lib/i18n/missing_translations/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(app, filename = nil) ⇒ MissingTranslations
constructor
A new instance of MissingTranslations.
- #locale_dir ⇒ Object
- #log ⇒ Object
Constructor Details
#initialize(app, filename = nil) ⇒ MissingTranslations
Returns a new instance of MissingTranslations.
19 20 21 22 |
# File 'lib/i18n/missing_translations.rb', line 19 def initialize(app, filename = nil) @app = app @filename = filename || "#{locale_dir}/missing_translations.yml" end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
17 18 19 |
# File 'lib/i18n/missing_translations.rb', line 17 def app @app end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
17 18 19 |
# File 'lib/i18n/missing_translations.rb', line 17 def filename @filename end |
Instance Method Details
#call(*args) ⇒ Object
24 25 26 27 |
# File 'lib/i18n/missing_translations.rb', line 24 def call(*args) log.read(filename) app.call(*args).tap { log.write(filename) } end |
#locale_dir ⇒ Object
33 34 35 |
# File 'lib/i18n/missing_translations.rb', line 33 def locale_dir File.directory?("#{Dir.pwd}/config/locales") ? "#{Dir.pwd}/config/locales" : Dir.pwd end |
#log ⇒ Object
29 30 31 |
# File 'lib/i18n/missing_translations.rb', line 29 def log I18n.missing_translations end |