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
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.2 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.1 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.6.0 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.17 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.16 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.15 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.14 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.13 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.12 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.11 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.10 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.9 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb
classiccms-0.5.8 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/hash/deep_dup.rb
activesupport-3.1.8 lib/active_support/core_ext/hash/deep_dup.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/deep_dup.rb