Class: I18nUno::Comparer
- Inherits:
-
Object
- Object
- I18nUno::Comparer
- Defined in:
- lib/i18n_uno/comparer.rb
Instance Attribute Summary collapse
-
#source_file ⇒ Object
Returns the value of attribute source_file.
-
#target_file ⇒ Object
Returns the value of attribute target_file.
Instance Method Summary collapse
- #compare ⇒ Object
-
#initialize(source_file, target_file) ⇒ Comparer
constructor
A new instance of Comparer.
Constructor Details
#initialize(source_file, target_file) ⇒ Comparer
Returns a new instance of Comparer.
9 10 11 12 |
# File 'lib/i18n_uno/comparer.rb', line 9 def initialize(source_file, target_file) @source_file = source_file @target_file = target_file end |
Instance Attribute Details
#source_file ⇒ Object
Returns the value of attribute source_file.
7 8 9 |
# File 'lib/i18n_uno/comparer.rb', line 7 def source_file @source_file end |
#target_file ⇒ Object
Returns the value of attribute target_file.
7 8 9 |
# File 'lib/i18n_uno/comparer.rb', line 7 def target_file @target_file end |
Instance Method Details
#compare ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/i18n_uno/comparer.rb', line 14 def compare source_keys = flatten_keys(normalize_data(source_file.content_hash)) target_keys = flatten_keys(normalize_data(target_file.content_hash)) new_keys = compare_keys(target_keys, source_keys) removed_keys = compare_keys(source_keys, target_keys) I18nUno::Delta.new( new_keys: new_keys, removed_keys: removed_keys, target_keys_size: target_keys.size ) end |