What’s new in Ruby 2.5


Bookmark and Share

The Ruby language has increasingly stabilized over the years. The upcoming release of Ruby 2.5 is not going to let us down too. It introduces lots of new features and improvements over the previous version. The first preview was released on 10th October 2017 and the final build will be released on this 25th. This blog dissects into this latest and exciting release and goes through some of the most important changes, we will be writing another article on performance improvement once the 2.5 if officially released.

  • Added Hash#transform_keys method

Ruby 2.4 added the transform_values method, 2.5 completes it by adding transform_keys thus make it a perfect pair.

Hash#transform_keys can change keys according to the return value of a block:

transform_keys! is a destructive version:

We know how many times we had to manipulate the keys of a hash. transform_keys is gonna be a game changer and going to be very compelling to be used in your legacy app. The destructive version is a just silver lining to this.

  • Array#prepend and Array#append

Ruby 2.5 brings home two new aliases which are so much better than the two of the most used operations in the language. Array#prepend and Array#append are more programmer friendly than the …

Read More