Skip to content

Instantly share code, notes, and snippets.

@afa
Created March 15, 2012 11:18
Show Gist options
  • Save afa/2043722 to your computer and use it in GitHub Desktop.
Save afa/2043722 to your computer and use it in GitHub Desktop.
зачистка всех непозволенных ключей из хэша
{1=>2, 3=>4}.select{|a, b| [1].include? a }.inject({}){|r, v| r.merge(v[0] => v[1]) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment