Turning Off Warnings In Code

S

Sean O'Dell

This seems like something really simple, but I can't figure out it's done.

How do you turn warnings off in code? Meaning, not launching Ruby with -w0,
just turning them off with Ruby code.

Sean O'Dell
 
M

Mauricio Fernández

This seems like something really simple, but I can't figure out it's done.

How do you turn warnings off in code? Meaning, not launching Ruby with -w0,
just turning them off with Ruby code.

$VERBOSE = nil
 
R

Robert Klemme

Mauricio Fernández said:
$VERBOSE = nil

Or how about:

module Kernel
private
def no_warn
old = $VERBOSE
begin
yield
ensure
$VERBOSE = old
end
end
end

Both variants don't seem to help agains syntax warnings though (which is
completely logical if you keep in mind when they appear).

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top