Class: Decidim::TermCustomizer::Context::Base
- Inherits:
-
Object
- Object
- Decidim::TermCustomizer::Context::Base
- Defined in:
- lib/decidim/term_customizer/context/base.rb
Overview
A context object resolves and stores the translation context for different application contexts. Contexts can be e.g.
-
Controller context, which is used to display translations in controller messages and the views.
-
Job context, which is used to display messages within jobs, mainly when sending emails.
The initialization method gets the data for the context which is used to resolve the translation context objects (organization, participatory space and component). These are then used to load the correct translations for each context based on the translation set constraints.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#space ⇒ Object
readonly
Returns the value of attribute space.
Instance Method Summary collapse
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
20 21 22 23 24 25 |
# File 'lib/decidim/term_customizer/context/base.rb', line 20 def initialize(data) @data = data # Implement the resolve! method in the sub-classes resolve! end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
18 19 20 |
# File 'lib/decidim/term_customizer/context/base.rb', line 18 def component @component end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
18 19 20 |
# File 'lib/decidim/term_customizer/context/base.rb', line 18 def organization @organization end |
#space ⇒ Object (readonly)
Returns the value of attribute space.
18 19 20 |
# File 'lib/decidim/term_customizer/context/base.rb', line 18 def space @space end |