From: Justin Collins Date: 2010-10-04T12:43:15+09:00 Subject: Re: How to suppress display of specific code in irb?? On 10/03/2010 07:33 PM, Don Norcott wrote: > I am very new to ruby (but a retired experienced C programmer) and am > getting buried in the amount of documentation available. Have been > unable to find an answer to this question, but perhaps do not understand > the concepts involved enough to search correctly. Given this code > > require 'hpricot' > url = "http://www....." > doc = Hpricot.XML(open(url)) > > In interactive ruby can I suppress the output produced by > Hpricot.XML(open(url)) > > is this the stdout stream or is it something else? At completion the > HTML is in the doc object so is there any need for it to also be > displayed. Perhaps the object has a means of suppressing the data being > loaded? > > I am working with web pages and a very large amount of data is involved. > When I mark and copy the irb window to a file to do searches on the data > I have a lot of unneeded and duplicated data. Perhaps there are IRB > parameters to resolve this > > I know I can redirect to a file then use the file (but still have same > problem when opening file for processing), but what I would like to do > is the equivalent of redirecting stdout (if it is stdout) to NULL on a > per line basis. > > Thanks RustySam > What you could do is simply append "; nil" to the end of the line: irb(main):001:0> s = "some really, really long string" ; nil => nil -Justin