Use `select!` when a collection should keep only the elements that pass a block’s test—and the original collection should change. Arrays, hashes, and sets provide this in-place counterpart to `select` (also called `filter`). section 10.3.2
Keep selected hash pairs
`h = {1 => 2, 3 => 4, 5 => 6}` `h.select! {|key, value| key > 1 } # => {3 => 4, 5 => 6}` `h # => {3 => 4, 5 => 6}` `h.select! {|key, value| key > 1 } # => nil` The block tests each key/value pair. The first call removes a pair; the second has nothing left to remove, so it returns `nil`. section 9.3.5
The return value matters: `nil` means the selection made no change, not that it produced an empty collection. Unlike `select!`, `select` returns a separate result. For a hash operation that changes the receiver but returns that hash even when unchanged, use `keep_if`. section 9.3.5 section 10.3.2
`reject!` is the in-place counterpart for the opposite test: it removes elements for which the block returns true. There is also a `filter!` alias for `select!`, but no `find_all!` synonym. section 9.3.5 section 10.3.2
