Ruby – Does ruby have the array method select! or not

ruby

> a = %w(a b c)
 => ["a", "b", "c"] 
> a.select!{|e| !e.nil?}
NoMethodError: undefined method `select!' for ["a", "b", "c"]:Array
    from (irb):2

ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.5.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02

The doc says there is a method called select! in array.

http://www.ruby-doc.org/core/classes/Array.html#M000252

Best Solution

Ruby 1.8.7 does have Array#reject!, though:

>> a = [1, 2, nil]
=> [1, 2, nil]
>> a.reject! &:nil?
=> [1, 2]