Sha256: feab3f91e33669b71c8dac00e5e8f89a9e85fe4b76d665e4c7c7a11fc5a0e9ee
Contents?: true
Size: 726 Bytes
Versions: 4
Compression:
Stored size: 726 Bytes
Contents
module I18n::Tasks module Stats def forest_stats(forest) key_count = forest.leaves.count locale_count = forest.count if key_count.zero? {key_count: 0} else { locales: forest.map(&:key).join(', '), key_count: key_count, locale_count: locale_count, per_locale_avg: forest.inject(0) { |sum, f| sum + f.leaves.count } / locale_count, key_segments_avg: '%.1f' % (forest.leaves.inject(0) { |sum, node| sum + node.walk_to_root.count - 1 } / key_count.to_f), value_chars_avg: forest.leaves.inject(0) { |sum, node| sum + node.value.length } / key_count } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
i18n-tasks-0.7.3 | lib/i18n/tasks/stats.rb |
i18n-tasks-0.7.2 | lib/i18n/tasks/stats.rb |
i18n-tasks-0.7.1 | lib/i18n/tasks/stats.rb |
i18n-tasks-0.7.0 | lib/i18n/tasks/stats.rb |