Skip to content

Instantly share code, notes, and snippets.

@raecoo
Created September 16, 2014 02:35
Show Gist options
  • Save raecoo/9c05819afa792f478762 to your computer and use it in GitHub Desktop.
Save raecoo/9c05819afa792f478762 to your computer and use it in GitHub Desktop.
Remove useless whitespace by Lambda
thunk = lambda do |key,value|
case value
when String then value.strip!
when Hash then value.each(&thunk)
when Array then value.each {|vv| vv.strip!}
end
end
[Hash].each(&thunk)
@raecoo
Copy link
Author

raecoo commented Sep 19, 2014

Ruby 2.1.x test passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment