Created
March 13, 2013 11:26
-
-
Save Jacke/5151244 to your computer and use it in GitHub Desktop.
If in old hash exist record, then in new nil value can be accepted, otherwise if not nil it would be rejected
This file contains hidden or 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
| hash_old = {"a"=>100, "b"=>""} | |
| Hash["a", "", "", ""].reject { |k,v| v.blank? if hash_old[k].blank? } | |
| # => {"a"=>""} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment