Give the gift of Ruby this season

18 Dec 2018
Ori Pekelman
CPO

We’ve had Ruby 2.5 in beta for a while now, although we haven’t talked about it much. It’s been working wonderfully, though, and rubies make great holiday gifts for the geologists in your life. So it’s time to go General Availability!

What gems does this version have?

Ruby 2.5 has a bunch of very cool language features, and probably the most interesting is yield_self; it rather resembles the pipe operator from Elixir, and pipes are cool. Method chaining is also a great way to simplify syntax, and this basically gives you a more general approach then the .map and .select we’re already used to.

Also nice in day-to-day life “rescue in do blocks” it reduces clutter and unnecessary indentation.

things.each do |thing|
  thing.evil_method_that_bombs
rescue VeryBadError => exception
  p exception
  next
end

Short and sweet.

Is it expensive like a real ruby?

Not at all! As always, migrating your Ruby apps is as easy as changing a single character in your .platform.app.yaml file:

so instead of :

type: "ruby:2.4"

Go for the brand new:

type: "ruby:2.5"

Create a branch, push, and test that everything works on your development environment. If it all checks out, merge. Now you’re running Ruby 2.5 in production. (And you probably just gained around 10% performance, too. Go you!)

A number of Ruby applications already require 2.5 or higher, such as the latest Discourse betas. So if this is your jam…go forth and deploy.