Sha256: ebe2cf69cb10337cec3f47b2d9a9c56b214f0b577d997f7507cf5e6004612288
Contents?: true
Size: 583 Bytes
Versions: 4
Compression:
Stored size: 583 Bytes
Contents
#!/usr/bin/env ruby class Hash def locale_diff(b) a = self (a.keys | b.keys).inject({}) do |diff, k| if a[k].respond_to?(:deep_diff) && b[k].respond_to?(:deep_diff) deeper_diff = a[k].deep_diff(b[k]) diff[k] = deeper_diff if deeper_diff != {} else if !a.keys.include?(k) # omit extra strings # diff[k] = 'extra' elsif !b.keys.include?(k) diff[k] = '[pls translate]' + a[k] else # keep translated strings diff[k] = b[k] end end diff end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rabelyoda-1.1.0 | lib/rabelyoda/hash.rb |
rabelyoda-1.0.3 | lib/rabelyoda/hash.rb |
rabelyoda-1.0.2 | lib/rabelyoda/hash.rb |
rabelyoda-1.0.1 | lib/rabelyoda/hash.rb |