1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00
Files
til/ruby/silence-the-output-of-a-ruby-statement-in-pry.md

514 B

Silence The Output Of A Ruby Statement In Pry

Sometimes running a command in a pry session can produce a bunch of verbose output that you aren't interested in seeing.

Here is a contrived line of code whose output will take over the entire screen:

(1..200).map { |i| i*i }
#=> [1,
4,
9,
16,
...

You can silence all of this output by tacking on a single character -- ;.

(1..200).map { |i| i*i };

source