Skip to content

Instantly share code, notes, and snippets.

@polamjag
Created May 7, 2015 12:00
Show Gist options
  • Save polamjag/2678086ee0c026f0c3fb to your computer and use it in GitHub Desktop.
Save polamjag/2678086ee0c026f0c3fb to your computer and use it in GitHub Desktop.
super dirty deep_except in Ruby
# deep_except
class Hash
def deep_except!(*keys)
keys.each { |key| delete(key) }
self.each { |k, v|
v.except!(*keys) if v.is_a? Hash
}
self
end
def deep_except(*keys)
dup.deep_except!(*keys)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment