add method 'extract' to hash

for example https://github.com/mokevnin/rails-examples/blob/develop/app/controllers/web/passwords_controller.rb

def confirm
    user = User.where(params.extract(:id, :confirmation_token)).first!

i can't use method slice, since with empty params i get empty hash.