Module: HashRecursiveBlank

Included in:
Hash
Defined in:
lib/rblank.rb

Overview

You should have received a copy of the GNU General Public License along with TDI. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#rblankObject



21
22
23
24
25
26
27
28
29
# File 'lib/rblank.rb', line 21

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

#rblank!Object



31
32
33
34
35
36
37
# File 'lib/rblank.rb', line 31

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