class Hash # In-place version of Hash#select. The opposite of the built-in # Hash#reject!. # # CREDIT Noah Gibbs # CREDIT Gavin Sinclair def select! reject! { |k,v| not yield(k,v) } end end