Class: ActionView::I18nProxy
- Inherits:
-
I18n::Config
- Object
- I18n::Config
- ActionView::I18nProxy
- Defined in:
- lib/action_view/rendering.rb
Overview
This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, it will trigger the lookup_context and consequently expire the cache.
Instance Attribute Summary collapse
-
#lookup_context ⇒ Object
readonly
:nodoc:.
-
#original_config ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(original_config, lookup_context) ⇒ I18nProxy
constructor
A new instance of I18nProxy.
- #locale ⇒ Object
- #locale=(value) ⇒ Object
Constructor Details
#initialize(original_config, lookup_context) ⇒ I18nProxy
Returns a new instance of I18nProxy.
9 10 11 12 |
# File 'lib/action_view/rendering.rb', line 9 def initialize(original_config, lookup_context) original_config = original_config.original_config if original_config.respond_to?(:original_config) @original_config, @lookup_context = original_config, lookup_context end |
Instance Attribute Details
#lookup_context ⇒ Object (readonly)
:nodoc:
7 8 9 |
# File 'lib/action_view/rendering.rb', line 7 def lookup_context @lookup_context end |
#original_config ⇒ Object (readonly)
:nodoc:
7 8 9 |
# File 'lib/action_view/rendering.rb', line 7 def original_config @original_config end |
Instance Method Details
#locale ⇒ Object
14 15 16 |
# File 'lib/action_view/rendering.rb', line 14 def locale @original_config.locale end |
#locale=(value) ⇒ Object
18 19 20 |
# File 'lib/action_view/rendering.rb', line 18 def locale=(value) @lookup_context.locale = value end |