Sha256: b6b843e986d4f1a23bc51b45b68bd46929b78fa7f5ba30ff93d4f0638041e4f6

Contents?: true

Size: 244 Bytes

Versions: 153

Compression:

Stored size: 244 Bytes

Contents

class Hash
  # Returns a deep copy of hash.
  def deep_dup
    duplicate = self.dup
    duplicate.each_pair do |k,v|
      tv = duplicate[k]
      duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v
    end
    duplicate
  end
end

Version data entries

153 entries across 140 versions & 7 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.7.2 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.7.1 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.7.0 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
activesupport-3.1.12 lib/active_support/core_ext/hash/deep_dup.rb
activesupport-3.1.11 lib/active_support/core_ext/hash/deep_dup.rb
activesupport-3.1.10 lib/active_support/core_ext/hash/deep_dup.rb
activesupport-3.1.9 lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.9 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.8 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.7 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.6 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb