Ruby 1.8.7 Released: Enumeration Object Support Backported From 1.9

By Peter Cooper

With all the excitement surrounding RailsConf 2008 and the Maglev announcement, news of the release of Ruby 1.8.7 passed rather quietly. The download URLs can be found here, but note that the official Ruby-Lang.org download page does not reflect 1.8.7's release yet.

Ruby 1.8.7 is a point release of the stable, production-ready 1.8.x branch, so it should be ready to roll out to your deployment environments but be cautious. It features many bug fixes, but also some performance enhancements and significant back-ports of Ruby 1.9 functionality (enumeration objects in particular). More information is available in the release NEWS file. The most interesting developments include:

vendor_ruby

A new library directory named `vendor_ruby' is introduced in addition to `site_ruby'. The idea is to separate libraries installed by the package system (`vendor') from manually (`site') installed libraries preventing the former from getting overwritten by the latter, while preserving the user option to override vendor libraries with site libraries. (`site_ruby' takes precedence over `vendor_ruby')

securerandom

securerandom is a Ruby 1.9 library that's now part of the Ruby 1.8 standard library too. Example: require 'securerandom'; SecureRandom.random_bytes(16)

Array#flatten changes

Array#flatten now takes an optional argument that determines how deep to perform flattening.

Array method changes

Array#collect!, Array#map!, Array#each, Array#each_index, Array#reverse_each, Array#reject, Array#reject! and Array#delete_if now return an enumerator if no block is given. Array#pop and Array#shift now take an optional argument specifying the number of elements to remove from the array.

Binding#eval

Binding#eval is a new method to enable evaluations to take place in the context of a binding.

Enumerable::Enumerator added

Enumerable::Enumerator adds support for enumerations to be dealt with as objects, as in Ruby 1.9.

Enumerator support on many classes

Many methods based on IO, Integer, Array (see above), ARGF, Numeric, ObjectSpace, Range, String, and Struct now support returning enumerator objects where no blocks are given.

net/smtp

net/smtp now supports SSL/TLS connections.

These items really only scratch the surface though. Dig into the NEWS file for more info.