Method: Hash#replace
- Defined in:
- ext/enterprise_script_service/mruby/mrblib/hash.rb
#replace(hash) ⇒ Object Also known as: initialize_copy
Replaces the contents of hsh with the contents of other hash
ISO 15.2.13.4.23
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'ext/enterprise_script_service/mruby/mrblib/hash.rb', line 151 def replace(hash) raise TypeError, "Hash required (#{hash.class} given)" unless Hash === hash self.clear hash.each_key{|k| self[k] = hash[k] } if hash.default_proc self.default_proc = hash.default_proc else self.default = hash.default end self end |