From: Xavier Noria Date: 2006-02-10T19:26:54+09:00 Subject: Re: Hiding warnings On Feb 10, 2006, at 11:13, Mark Somerville wrote: > I have a couple of sections of code that I don't want any warnings > displayed > for. I'd still like the warnings for the rest of the application. > > Can I turn warnings on and off programatically? Yes, the idiom is $VERBOSE = nil. -- fxn % irb irb(main):001:0> a = [] => [] irb(main):002:0> a.push (0) (irb):2: warning: don't put space before argument parentheses => [0] irb(main):003:0> current_W = $VERBOSE => false irb(main):004:0> $VERBOSE = nil => nil irb(main):005:0> a.push (0) => [0, 0] irb(main):006:0> $VERBOSE = current_W => false irb(main):007:0> a.push (0) (irb):7: warning: don't put space before argument parentheses => [0, 0, 0]