Sha256: 9281479142b20be8f3381a19628e242f816bafc9e4649d93a8c1c5adeedc4fbb
Contents?: true
Size: 694 Bytes
Versions: 1
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true module CaseTransform2 # @api private class HashExt def deep_transform_keys!(object, &block) _deep_transform_keys_in_object!(object, &block) end private def _deep_transform_keys_in_object!(object, &block) # rubocop:disable Metrics/MethodLength case object when Hash object.keys.each do |key| # rubocop:disable Style/HashEachMethods value = object.delete(key) object[yield(key)] = _deep_transform_keys_in_object!(value, &block) end object when Array object.map! { |e| _deep_transform_keys_in_object!(e, &block) } else object end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
case_transform2-1.1.1 | lib/case_transform2/hash_ext.rb |