Forum: Ruby how to ignore warning

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1b507a552850441a516948d488962d2e?d=identicon&s=25 Sniper Abandon (mokkai)
on 2007-10-11 05:08
how to ignore warning messages in ruby (when executing ruby code)
4d60ea85b83de9f19821ecdfa8689219?d=identicon&s=25 Konrad Meyer (konrad)
on 2007-10-11 05:28
(Received via mailing list)
Quoth Pokkai Dokkai:
> how to ignore warning messages in ruby (when executing ruby code)

Close your eyes and tap your heels thrice.
No, really, ignoring things is as easy as not looking at them. (In all
likelihood you should fix your code to not have warnings instead.)

Regards,
807270f56f26ad90755eef71f2c228fe?d=identicon&s=25 Alex Gutteridge (Guest)
on 2007-10-11 05:49
(Received via mailing list)
On 11 Oct 2007, at 12:26, Konrad Meyer wrote:

> Quoth Pokkai Dokkai:
>> how to ignore warning messages in ruby (when executing ruby code)
>
> Close your eyes and tap your heels thrice.
> No, really, ignoring things is as easy as not looking at them. (In all
> likelihood you should fix your code to not have warnings instead.)

I agree with Konrad that you should probably fix warnings rather than
ignore, but -W is the command line flag you want. -W1 is standard, -
W2 is verbose, -W0 is no warnings whatsoever.

Alex Gutteridge

Bioinformatics Center
Kyoto University
1b507a552850441a516948d488962d2e?d=identicon&s=25 Sniper Abandon (mokkai)
on 2007-10-11 06:28
Alex Gutteridge wrote:

> I agree with Konrad that you should probably fix warnings rather than
> ignore, but -W is the command line flag you want. -W1 is standard, -
> W2 is verbose, -W0 is no warnings whatsoever.
>
> Alex Gutteridge
>
> Bioinformatics Center
> Kyoto University

thank you Alex
A131b672fdbd2a58dce12031ad78b121?d=identicon&s=25 Wolfgang Nádasi-Donner (wonado)
on 2007-10-11 12:22
Alex Gutteridge wrote:
> -W is the command line flag you want. -W1 is standard, -
> W2 is verbose, -W0 is no warnings whatsoever.

Is there a possibility to ignore warnings dynamically? - I mean,
sometimes it's helpful to redefine constants, which will always produce
a warning. I want to suppress warnings for these lines only.

Wolfgang Nádasi-Donner
C06869c119472a139eb163b72040b0db?d=identicon&s=25 Bertram Scharpf (Guest)
on 2007-10-11 12:25
(Received via mailing list)
Hi,

Am Donnerstag, 11. Okt 2007, 12:48:22 +0900 schrieb Alex Gutteridge:
> -W1 is standard, -W2 is
> verbose, -W0 is no warnings whatsoever.

Or set one of the variables $-v, $-w, $VERBOSE to 'nil'.

   Option    $-v
   -W0       nil
   -W1       false
   -W2       true

Bertram
C06869c119472a139eb163b72040b0db?d=identicon&s=25 Bertram Scharpf (Guest)
on 2007-10-11 13:52
(Received via mailing list)
Hi,

Am Donnerstag, 11. Okt 2007, 19:22:31 +0900 schrieb Wolfgang
Nádasi-Donner:
> Alex Gutteridge wrote:
> > -W is the command line flag you want. -W1 is standard, -
> > W2 is verbose, -W0 is no warnings whatsoever.
>
> Is there a possibility to ignore warnings dynamically? - I mean,
> sometimes it's helpful to redefine constants, which will always produce
> a warning. I want to suppress warnings for these lines only.


  irb(main):001:0> X = "x"
  => "x"
  irb(main):002:0> class Object ; remove_const :X ; end
  => "x"
  irb(main):003:0> X
  NameError: uninitialized constant X
          from (irb):3
  irb(main):004:0> X = "y"
  => "y"
  irb(main):005:0>


Bertram
A131b672fdbd2a58dce12031ad78b121?d=identicon&s=25 Wolfgang Nádasi-Donner (wonado)
on 2007-10-11 14:55
Bertram Scharpf wrote:
>   irb(main):001:0> X = "x"
>   => "x"
>   irb(main):002:0> class Object ; remove_const :X ; end
>   => "x"
>   irb(main):003:0> X
>   NameError: uninitialized constant X
>           from (irb):3
>   irb(main):004:0> X = "y"
>   => "y"
>   irb(main):005:0>

Well - it looks fine, because it's no dirty trick.

Wolfgang Nádasi-Donner
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2007-10-11 15:06
(Received via mailing list)
On 10/10/07, Konrad Meyer <konrad@tylerc.org> wrote:
> Quoth Pokkai Dokkai:
> > how to ignore warning messages in ruby (when executing ruby code)
>
> Close your eyes and tap your heels thrice.
> No, really, ignoring things is as easy as not looking at them.

Or cover your head with your towel, rubyists should ALWAYS have their
towel handy.

And as the Hitchhiker's Guide to Ruby explains this is also the best
defense against being eaten by the ravenous bugblatter beast of Traal!
--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (Guest)
on 2007-10-16 14:08
(Received via mailing list)
Bertram Scharpf wrote:
>
>   irb(main):001:0> X = "x"
>   => "x"
>   irb(main):002:0> class Object ; remove_const :X ; end
>   => "x"
>   irb(main):003:0> X
>   NameError: uninitialized constant X
>           from (irb):3
>   irb(main):004:0> X = "y"
>   => "y"
>   irb(main):005:0>

Yuck.

I've pushed for structured warnings in the past, but it has fallen on
deaf ears.

See:

http://osdir.com/ml/lang.ruby.sydney.devel/2005-10...
http://osdir.com/ml/lang.ruby.sydney.devel/2005-10...
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/...

Regards,

Dan
4c3acdc3d93f54cc7a7281780ec8a4ee?d=identicon&s=25 Shai Rosenfeld (shai)
on 2007-10-16 14:57
Rick Denatale wrote:
> Or cover your head with your towel, rubyists should ALWAYS have their
> towel handy.
>
> And as the Hitchhiker's Guide to Ruby explains this is also the best
> defense against being eaten by the ravenous bugblatter beast of Traal!
> --
> Rick DeNatale
>
> My blog on Ruby
> http://talklikeaduck.denhaven2.com/

likin' it :)
9fe52c6cee76394528c11e4a6655ff9f?d=identicon&s=25 Bob Asdflkj (bob-asdflkj)
on 2009-11-19 22:37
Konrad Meyer wrote:
> Quoth Pokkai Dokkai:
>> how to ignore warning messages in ruby (when executing ruby code)
>
> Close your eyes and tap your heels thrice.
> No, really, ignoring things is as easy as not looking at them. (In all
> likelihood you should fix your code to not have warnings instead.)
>
> Regards,

Ruby will spit out warnings for white space  -  with no coding errors,

and many programming languages output warnings for using anything but
the most basic techniques

so weather you're a novice or a seasoned veteran there are valid reasons
to suppress warnings:  after all, it does have W levels
This topic is locked and can not be replied to.