Class: Traductor::Diff
- Inherits:
-
Object
- Object
- Traductor::Diff
- Defined in:
- lib/traductor/diff.rb
Instance Attribute Summary collapse
-
#added ⇒ Object
readonly
Returns the value of attribute added.
-
#removed ⇒ Object
readonly
Returns the value of attribute removed.
-
#unchanged ⇒ Object
readonly
Returns the value of attribute unchanged.
Instance Method Summary collapse
-
#initialize(source_flat:, target_flat:) ⇒ Diff
constructor
A new instance of Diff.
-
#keys_to_translate ⇒ Object
Returns only the keys that need translation (new keys not yet in target).
- #summary ⇒ Object
Constructor Details
#initialize(source_flat:, target_flat:) ⇒ Diff
Returns a new instance of Diff.
7 8 9 10 11 |
# File 'lib/traductor/diff.rb', line 7 def initialize(source_flat:, target_flat:) @source_flat = source_flat @target_flat = target_flat compute end |
Instance Attribute Details
#added ⇒ Object (readonly)
Returns the value of attribute added.
5 6 7 |
# File 'lib/traductor/diff.rb', line 5 def added @added end |
#removed ⇒ Object (readonly)
Returns the value of attribute removed.
5 6 7 |
# File 'lib/traductor/diff.rb', line 5 def removed @removed end |
#unchanged ⇒ Object (readonly)
Returns the value of attribute unchanged.
5 6 7 |
# File 'lib/traductor/diff.rb', line 5 def unchanged @unchanged end |
Instance Method Details
#keys_to_translate ⇒ Object
Returns only the keys that need translation (new keys not yet in target)
14 15 16 |
# File 'lib/traductor/diff.rb', line 14 def keys_to_translate @added end |
#summary ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/traductor/diff.rb', line 18 def summary { added: @added.size, removed: @removed.size, unchanged: @unchanged.size } end |