Class: Decidim::TermCustomizer::Context::Base

Inherits:
Object
  • Object
show all
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

ControllerContext, JobContext

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#componentObject (readonly)

Returns the value of attribute component.



18
19
20
# File 'lib/decidim/term_customizer/context/base.rb', line 18

def component
  @component
end

#organizationObject (readonly)

Returns the value of attribute organization.



18
19
20
# File 'lib/decidim/term_customizer/context/base.rb', line 18

def organization
  @organization
end

#spaceObject (readonly)

Returns the value of attribute space.



18
19
20
# File 'lib/decidim/term_customizer/context/base.rb', line 18

def space
  @space
end