Class: I18nize::MissingSet
- Inherits:
-
Object
- Object
- I18nize::MissingSet
- Defined in:
- lib/i18nize/missing_set.rb
Overview
Set of missing translations
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#from_locale ⇒ Object
readonly
Returns the value of attribute from_locale.
-
#to_locale ⇒ Object
readonly
Returns the value of attribute to_locale.
Instance Method Summary collapse
- #character_count ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(from_locale:, to_locale:, data:) ⇒ MissingSet
constructor
A new instance of MissingSet.
- #keys_by_file ⇒ Object
- #total_keys ⇒ Object
- #values_by_file ⇒ Object
Constructor Details
#initialize(from_locale:, to_locale:, data:) ⇒ MissingSet
Returns a new instance of MissingSet.
8 9 10 11 12 |
# File 'lib/i18nize/missing_set.rb', line 8 def initialize(from_locale:, to_locale:, data:) @from_locale = from_locale @to_locale = to_locale @data = data # hash: { file => { key => value } } end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/i18nize/missing_set.rb', line 6 def data @data end |
#from_locale ⇒ Object (readonly)
Returns the value of attribute from_locale.
6 7 8 |
# File 'lib/i18nize/missing_set.rb', line 6 def from_locale @from_locale end |
#to_locale ⇒ Object (readonly)
Returns the value of attribute to_locale.
6 7 8 |
# File 'lib/i18nize/missing_set.rb', line 6 def to_locale @to_locale end |
Instance Method Details
#character_count ⇒ Object
22 23 24 |
# File 'lib/i18nize/missing_set.rb', line 22 def character_count data.values.flat_map(&:values).join.length end |
#empty? ⇒ Boolean
14 15 16 |
# File 'lib/i18nize/missing_set.rb', line 14 def empty? data.empty? end |
#keys_by_file ⇒ Object
26 27 28 |
# File 'lib/i18nize/missing_set.rb', line 26 def keys_by_file data.transform_values(&:keys) end |
#total_keys ⇒ Object
18 19 20 |
# File 'lib/i18nize/missing_set.rb', line 18 def total_keys data.values.map(&:keys).flatten.size end |
#values_by_file ⇒ Object
30 31 32 |
# File 'lib/i18nize/missing_set.rb', line 30 def values_by_file data end |