Method: Hash#copy_traits!
- Defined in:
- lib/enumerate_hash_values/core_extensions/hash.rb
#copy_traits!(hash) ⇒ Object
Copy any traits (such as defaults) from the specified hash.
56 57 58 59 60 61 62 63 64 |
# File 'lib/enumerate_hash_values/core_extensions/hash.rb', line 56 def copy_traits!(hash) self.default = hash.default # Unfortunately, we can only transfer Hash#default_proc in Ruby 1.9 because # Hash#default_proc= is only defined in Ruby 1.9. self.default_proc = hash.default_proc if respond_to?(:default_proc=) self end |