suppress ruby warnings during runtime?

A

Aaron Smith

I've been looking for a way to supress warnings at runtime, not just in
the shebang line.. I've tride setting $VERBOSE = nil but that doesn't
seem to work right. Specifically i'm getting warnings when accessing
Object#id, saying it's deprecated.. is there a way to turn off just
deprecated warnings?

Thanks
 
E

Eric Hodel

I've been looking for a way to supress warnings at runtime, not
just in
the shebang line.. I've tride setting $VERBOSE = nil but that doesn't
seem to work right. Specifically i'm getting warnings when accessing
Object#id, saying it's deprecated.. is there a way to turn off just
deprecated warnings?

Change calls from .id to .object_id to turn off this warning.
 
N

Nobuyoshi Nakada

Hi,

At Fri, 24 Aug 2007 09:22:37 +0900,
Aaron Smith wrote in [ruby-talk:266024]:
I've been looking for a way to supress warnings at runtime, not just in
the shebang line.. I've tride setting $VERBOSE = nil but that doesn't
seem to work right. Specifically i'm getting warnings when accessing
Object#id, saying it's deprecated.. is there a way to turn off just
deprecated warnings?

Setting $VERBOSE = nil.

$ ruby -v -e id
ruby 1.8.6 (2007-08-21 revision 13127) [i686-linux]
-e:1: warning: Object#id will be deprecated; use Object#object_id

$ ruby -v -e '$VERBOSE=nil;id'
ruby 1.8.6 (2007-08-21 revision 13127) [i686-linux]
 
J

Johannes Held

Eric said:
Change calls from .id to .object_id to turn off this warning.
This sounds like rails.1
And the ID of a model is model.id. So you can't change id to object_id.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top