Sha256: 7c86877cbb364194ff6312bf322bef5187d7bc7f804cbf4e16165aa0b776ed78

Contents?: true

Size: 563 Bytes

Versions: 15

Compression:

Stored size: 563 Bytes

Contents

require 'active_support/core_ext/object/deep_dup'
require 'abstractivator/trees/block_collector'
require 'delegate'
require 'set'

module Abstractivator
  module Trees
    # recursively deletes the specified keys
    def recursive_delete!(hash, keys)
      x = hash # hash is named 'hash' for documentation purposes but may be anything
      case x
        when Hash
          keys.each{|k| x.delete(k)}
          x.each_value{|v| recursive_delete!(v, keys)}
        when Array
          x.each{|v| recursive_delete!(v, keys)}
      end
      x
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
abstractivator-0.20.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.19.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.18.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.17.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.16.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.15.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.14.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.13.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.12.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.11.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.10.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.8.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.7.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.6.0 lib/abstractivator/trees/recursive_delete.rb
abstractivator-0.5.0 lib/abstractivator/trees/recursive_delete.rb