Sha256: 6a8e66be05368c4801a3d47b29e6a7d14e3f108625ba13952be97afc684a004c
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
# # Copyright (C) 2013-2014 Globo.com # # This file is part of TDI. # TDI is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # TDI is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with TDI. If not, see <http://www.gnu.org/licenses/>. module HashRecursiveMerge def rmerge(other_hash) r = {} merge(other_hash) do |key, oldval, newval| r[key] = oldval.is_a?(Hash) ? oldval.rmerge(newval) : newval end end def rmerge!(other_hash) merge!(other_hash) do |key, oldval, newval| oldval.is_a?(Hash) ? oldval.rmerge!(newval) : newval end end end class Hash include HashRecursiveMerge end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
tdi-0.1.6 | lib/rmerge.rb |
tdi-0.1.5 | lib/rmerge.rb |
tdi-0.1.3 | lib/rmerge.rb |
tdi-0.1.2 | lib/rmerge.rb |
tdi-0.1.1 | lib/rmerge.rb |