Created
February 7, 2014 10:28
-
-
Save jaen/8860336 to your computer and use it in GitHub Desktop.
I dare you to change { } to do ... end. I double dare you, even.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def sanitise_recursively(params) | |
params.map { |key, value| | |
safe_value = case value | |
when Hash; Hash[sanitise_recursively(value)] | |
when Array; sanitise_recursively(value) | |
when String; @sanitiser.call(value) | |
else value | |
end | |
[ key, safe_value ] | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment