Class: Gitlab::I18n::MetadataEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/i18n/metadata_entry.rb

Constant Summary collapse

MAX_FORMS_TO_TEST =

Avoid testing too many plurals if `nplurals` was incorrectly set. Based on info on www.gnu.org/software/gettext/manual/html_node/Plural-forms.html which mentions special cases for numbers ending in 2 digits

101

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry_data) ⇒ MetadataEntry

Returns a new instance of MetadataEntry.


13
14
15
# File 'lib/gitlab/i18n/metadata_entry.rb', line 13

def initialize(entry_data)
  @entry_data = entry_data
end

Instance Attribute Details

#entry_dataObject (readonly)

Returns the value of attribute entry_data


6
7
8
# File 'lib/gitlab/i18n/metadata_entry.rb', line 6

def entry_data
  @entry_data
end

Instance Method Details

#expected_formsObject


17
18
19
20
21
# File 'lib/gitlab/i18n/metadata_entry.rb', line 17

def expected_forms
  return unless plural_information

  plural_information['nplurals'].to_i
end

#forms_to_testObject


23
24
25
# File 'lib/gitlab/i18n/metadata_entry.rb', line 23

def forms_to_test
  @forms_to_test ||= [expected_forms, MAX_FORMS_TO_TEST].compact.min
end