Suppress ruby warnings during runtime?

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

On Aug 23, 2007, at 17:22, Aaron S. wrote:

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.

Hi,

At Fri, 24 Aug 2007 09:22:37 +0900,
Aaron S. 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]

Eric H. schrieb:

On Aug 23, 2007, at 17:22, Aaron S. wrote:

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.
This sounds like rails.1
And the ID of a model is model.id. So you can’t change id to object_id.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs