Skip to content

Instantly share code, notes, and snippets.

@Jacke
Created March 13, 2013 11:26
Show Gist options
  • Select an option

  • Save Jacke/5151244 to your computer and use it in GitHub Desktop.

Select an option

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
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