Class: Gitlab::I18n::MetadataEntry
- Inherits:
-
Object
- Object
- Gitlab::I18n::MetadataEntry
- 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
-
#entry_data ⇒ Object
readonly
Returns the value of attribute entry_data.
Instance Method Summary collapse
- #expected_forms ⇒ Object
- #forms_to_test ⇒ Object
-
#initialize(entry_data) ⇒ MetadataEntry
constructor
A new instance of MetadataEntry.
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_data ⇒ Object (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_forms ⇒ Object
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_test ⇒ Object
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 |