Class: JavascriptI18n::Updater
- Inherits:
-
Object
- Object
- JavascriptI18n::Updater
- Includes:
- Singleton
- Defined in:
- lib/javascript_i18n/updater.rb
Instance Attribute Summary collapse
-
#last_update_time ⇒ Object
Returns the value of attribute last_update_time.
Instance Method Summary collapse
-
#initialize ⇒ Updater
constructor
A new instance of Updater.
- #most_recent_update_time ⇒ Object
- #should_update? ⇒ Boolean
Constructor Details
#initialize ⇒ Updater
Returns a new instance of Updater.
9 10 11 12 |
# File 'lib/javascript_i18n/updater.rb', line 9 def initialize # force first update self.last_update_time = DateTime.parse("1970-01-01 00:00:00") end |
Instance Attribute Details
#last_update_time ⇒ Object
Returns the value of attribute last_update_time.
7 8 9 |
# File 'lib/javascript_i18n/updater.rb', line 7 def last_update_time @last_update_time end |
Instance Method Details
#most_recent_update_time ⇒ Object
14 15 16 |
# File 'lib/javascript_i18n/updater.rb', line 14 def most_recent_update_time I18n.load_path.map { |translation_file| File.stat(translation_file).mtime }.max end |
#should_update? ⇒ Boolean
18 19 20 |
# File 'lib/javascript_i18n/updater.rb', line 18 def should_update? most_recent_update_time > last_update_time end |