Class: Decidim::TermCustomizer::PluralFormsManager

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/term_customizer/plural_forms_manager.rb

Overview

Checks that all the plural forms are in the database for the given keys.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization) ⇒ PluralFormsManager

Returns a new instance of PluralFormsManager.



15
16
17
18
# File 'lib/decidim/term_customizer/plural_forms_manager.rb', line 15

def initialize(organization)
  @organization = organization
  @default_locale = organization.default_locale
end

Class Attribute Details

.plural_keysObject

Returns the value of attribute plural_keys.



12
13
14
# File 'lib/decidim/term_customizer/plural_forms_manager.rb', line 12

def plural_keys
  @plural_keys
end

Instance Attribute Details

#organizationObject (readonly)

Returns the value of attribute organization.



7
8
9
# File 'lib/decidim/term_customizer/plural_forms_manager.rb', line 7

def organization
  @organization
end

Instance Method Details

#destroy!(translations) ⇒ Object



26
27
28
29
30
# File 'lib/decidim/term_customizer/plural_forms_manager.rb', line 26

def destroy!(translations)
  each_plural_form(translations) do |translation, key|
    destroy_locales_for!(translation, key)
  end
end

#fill!(translations) ⇒ Object



20
21
22
23
24
# File 'lib/decidim/term_customizer/plural_forms_manager.rb', line 20

def fill!(translations)
  each_plural_form(translations) do |translation, key|
    add_locales_for!(translation, key)
  end
end