Sha256: f9dacc4da7152098f0a96e4b0105703b398ec126a8f2f67691bbdca250791d4a
Contents?: true
Size: 1.03 KB
Versions: 11
Compression:
Stored size: 1.03 KB
Contents
# # Copyright (C) 2013-2015 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 HashRecursiveBlank def rblank r = {} each_pair do |key, val| r[key] = val.rblank if val.is_a?(Hash) end r.keep_if { |key, val| val.is_a?(Hash) } end def rblank! each_pair do |key, val| self[key] = val.rblank! if val.is_a?(Hash) end keep_if { |key, val| val.is_a?(Hash) } end end class Hash include HashRecursiveBlank end
Version data entries
11 entries across 11 versions & 1 rubygems