Class: Serega::SeregaUtils::EnumDeepDup
- Inherits:
-
Object
- Object
- Serega::SeregaUtils::EnumDeepDup
- Defined in:
- lib/serega/utils/enum_deep_dup.rb
Overview
Duplicates nested hashes and arrays It does not duplicate any non-Array and non-Hash values
Class Method Summary collapse
-
.call(data) ⇒ Hash, Array
Deeply duplicate provided Array or Hash data It does not duplicate any non-Array and non-Hash values.
Class Method Details
.call(data) ⇒ Hash, Array
Deeply duplicate provided Array or Hash data It does not duplicate any non-Array and non-Hash values
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/serega/utils/enum_deep_dup.rb', line 22 def call(data) case data when Hash # https://github.com/fastruby/fast-ruby#hash-vs-hashdup-code data = Hash[data] # rubocop:disable Style/HashConversion dup_hash_values(data) when Array data = data.dup dup_array_values(data) end data end |