File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010For a steady stream of TILs from a variety of rocketeers, checkout
1111[ til.hashrocket.com] ( https://til.hashrocket.com/ ) .
1212
13- _ 829 TILs and counting..._
13+ _ 830 TILs and counting..._
1414
1515---
1616
@@ -677,6 +677,7 @@ _829 TILs and counting..._
677677- [ Scroll To Top Of Page With Capybara] ( ruby/scroll-to-top-of-page-with-capybara.md )
678678- [ Set RVM Default Ruby] ( ruby/set-rvm-default-ruby.md )
679679- [ Show Public Methods With Pry] ( ruby/show-public-methods-with-pry.md )
680+ - [ Silence The Output Of A Ruby Statement In Pry] ( ruby/silence-the-output-of-a-ruby-statement-in-pry.md )
680681- [ Squeeze Out The Extra Space] ( ruby/squeeze-out-the-extra-space.md )
681682- [ String Interpolation With Instance Variables] ( ruby/string-interpolation-with-instance-variables.md )
682683- [ Summing Collections] ( ruby/summing-collections.md )
Original file line number Diff line number Diff line change 1+ # Silence The Output Of A Ruby Statement In Pry
2+
3+ Sometimes running a command in a [ ` pry ` ] ( https://github.com/pry/pry ) session
4+ can produce a bunch of verbose output that you aren't interested in seeing.
5+
6+ Here is a contrived line of code whose output will take over the entire screen:
7+
8+ ``` ruby
9+ (1 ..200 ).map { |i | i* i }
10+ # => [1,
11+ 4 ,
12+ 9 ,
13+ 16 ,
14+ ...
15+ ```
16+
17+ You can silence all of this output by tacking on a single character -- ` ; ` .
18+
19+ ``` ruby
20+ (1 ..200 ).map { |i | i* i };
21+ ```
22+
23+ [ source] ( https://gist.github.com/lfender6445/9919357 )
You can’t perform that action at this time.
0 commit comments