Mark Somerville
2/10/2006 11:12:00 AM
Spot on, thanks Xavier.
Mark
On Friday 10 February 2006 10:26, Xavier Noria wrote:
> 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]