Module: TRMNL::I18n::Synchronization
- Defined in:
- lib/trmnl/i18n/synchronization/repo.rb,
lib/trmnl/i18n/synchronization/processor.rb,
lib/trmnl/i18n/synchronization/value_reducer.rb
Defined Under Namespace
Constant Summary collapse
- ValueReducer =
Reduces a nested structure into key/value pairs with flattened values.
lambda do |initial_value, path = ""| case initial_value when Array initial_value.map.with_index do |item, index| ValueReducer.call item, "#{path}[#{index}]" end when Hash initial_value.each.with_object({}) do |(key, value), result| next_path = path.empty? ? key : "#{path}.#{key}" result[key] = ValueReducer.call value, next_path end else path end end