This blog is part of our Ruby 2.5 series.

Ruby 2.5.0-preview1 was recently released.

Ruby allows pretty printing of objects using pp method.

Before Ruby 2.5, we had to require PP explicitly before using it. Even the official documentation states that “All examples assume you have loaded the PP class with require ‘pp’”.

>> months = %w(January February March) => [ "January" , "February" , "March" ] >> pp months NoMethodError : undefined method `pp' for main:Object Did you mean? p from (irb):5 from /Users/prathamesh/.rbenv/versions/2.4.1/bin/irb:11: >> require 'pp' => true >> pp months ["January", "February", "March"] => ["January", "February", "March"]

In Ruby 2.5, we don’t need to require pp. It gets required by default. We can use it directly.

>> months = %w(January February March) => [ "January" , "February" , "March" ] >> pp months [ "January" , "February" , "March" ] => [ "January" , "February" , "March" ]

This feature was added after Ruby 2.5.0 preview 1 was released, so it’s not present in the preview. It’s present in Ruby trunk.