Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid printing after executing command in console

Tags:

ruby

I am opening very big YAML file. It takes a while. But after it opened it it is printing all its content - and it takes many times more time for it.

So how can I avoid printing result in Ruby console:

data = YAML.load_file( ... ) # some 1GB data file.
like image 235
fl00r Avatar asked Sep 09 '11 10:09

fl00r


2 Answers

I assume you are doing this in the console. I usually add just "; :ok" if I don't want to see the output.

data = YAML.load_file( ... ) ; :ok
like image 178
sunkencity Avatar answered Oct 20 '22 04:10

sunkencity


In Pry you can suppress output just by adding the semicolon:

pry(main)> data = YAML.load_file( ... );
pry(main)>

Output suppression is explained in the wiki here

like image 35
horseyguy Avatar answered Oct 20 '22 04:10

horseyguy