method

slice!

rails latest stable - Class: ActiveSupport::CoreExtensions::Hash::Slice

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

slice!(*keys)
public

Replaces the hash with only the given keys. Returns a hash contained the removed key/value pairs

  {:a => 1, :b => 2, :c => 3, :d => 4}.slice!(:a, :b) # => {:c => 3, :d =>4}