How to make your ruby code terminal friendly
Channel: Rails From Zero
Date: 2022-01-30

As a developer you can control the way others will see your code in the irb shell.

You can use it to display more data or obstruct certain information like long strings and passwords.

-= Relevant links =-

Source code: https://github.com/rails-from-zero/2022-1-terminal-friendly-code
Ruby on rails example: https://github.com/rails/rails/blob/df24d689bcb11953aa4e1ab5316873d2479255a3/activerecord/lib/active_record/relation.rb#L798

-= Chapters =-

0:00 Explanation on how IRB displays the last command output
1:43 Using inspect to change how a simple class is displayed
4:32 Using pretty_pretty print to change how complex data is displayed
13:18 Looking at how ActiveRecord leverages inspect and pretty_print

#ruby #irb #prettyprint