Reputation: 13929
I am not sure this is a bug or a new feature of Ruby 2.6, but since performing the upgrade 2.3 --> 2.6, my IRB terminal does not behave as usual and cannot hide outputs anymore. Previously when I typed a semicolon, it would wait until receiving the next instruction without semicolon to run all the code and hide values with semicolons
2.6.3 :008 > 1 + 1
=> 2
2.6.3 :009 > 1 + 1;
=> 2
2.6.3 :010 > (1 + 1);
=> 2
2.6.3 :011 > very_large_inspect_result;
=> [console keeps printing for ages)
Using ruby-2.6.3 [ x86_64 ]
and the IRB terminal from rails-5.1.6
What can I do to hide the output from commands ? The goal is to avoid printing huge strings of inspect
when returning a very large collection
EDIT : I could systematically add a 0 or something after the semicolons, but it feels cheap
2.6.3 :010 > (1 + 1); 0
=> 0
EDIT2 : what happened previously in Ruby 2.3.x :
irb(main):001:0> puts 1;
irb(main):002:0* puts 2;
irb(main):003:0* puts 3
1
2
3
=> nil
Upvotes: 2
Views: 285
Reputation: 93
Run the below command in IRB terminal.
irb_context.echo = false
Upvotes: 4