Sha256: ef6773f5ebfbcb9f8da58843067a9615fdd80b40b62c43e9730520404b8f179c
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 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 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
tdi-0.1.6 | lib/rblank.rb |
tdi-0.1.5 | lib/rblank.rb |
tdi-0.1.3 | lib/rblank.rb |
tdi-0.1.2 | lib/rblank.rb |
tdi-0.1.1 | lib/rblank.rb |