Stop rails console from printing out the object at the end of a loop Stop rails console from printing out the object at the end of a loop ruby ruby

Stop rails console from printing out the object at the end of a loop


If you don't want to disable the echo in general you could also call multiple expressions in one command line. Only the last expression's output will be displayed.

big_result(input); 0


Call conf.echo = false and it will not print the return value. This works for any irb session, not just Rails console.

In case you want to make it permanent, add it to your irb config.

echo 'IRB.conf[:ECHO] = false' >> $HOME/.irbrc


To temporarily stop the console from printing the return values you can issue a nil statement at the end of your loop or function, but before pressing the return.

record.each do |r|  puts r.propertiesend; nil

Or it can be a number too, if you want to reduce typing. But it can be confusing in scenarios, which I can't think of.

record.each do |r|  puts r.propertiesend; 0