Class: LocalPac::App::ApplicationController
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- LocalPac::App::ApplicationController
- Defined in:
- app/controllers/application_controller.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.local_storage_mutex ⇒ Object
readonly
Returns the value of attribute local_storage_mutex.
-
.translation_table_mutex ⇒ Object
readonly
Returns the value of attribute translation_table_mutex.
Instance Method Summary collapse
Class Attribute Details
.local_storage_mutex ⇒ Object (readonly)
Returns the value of attribute local_storage_mutex.
15 16 17 |
# File 'app/controllers/application_controller.rb', line 15 def local_storage_mutex @local_storage_mutex end |
.translation_table_mutex ⇒ Object (readonly)
Returns the value of attribute translation_table_mutex.
15 16 17 |
# File 'app/controllers/application_controller.rb', line 15 def translation_table_mutex @translation_table_mutex end |
Instance Method Details
#local_storage ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/application_controller.rb', line 18 def local_storage return @local_storage if @local_storage ApplicationController.local_storage_mutex.synchronize do if settings.respond_to? :local_storage LocalPac.ui_logger.debug 'Using local storage in production mode: loaded once on startup' @local_storage = settings.local_storage else LocalPac.ui_logger.debug 'Using local storage in development mode: reloaded per request' @local_storage = LocalPac::LocalStorage.new end end end |
#translation_table ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/application_controller.rb', line 32 def translation_table return @translation_table if @translation_table ApplicationController.translation_table_mutex.synchronize do if settings.respond_to? :translation_table LocalPac.ui_logger.debug 'Using translation table in production mode: loaded once on startup' @translation_table = settings.translation_table else LocalPac.ui_logger.debug 'Using translation table in development mode: reloaded per request' @translation_table = LocalPac::TranslationTable.new end end end |