Warning: The Experiment

Ruby's Warning module learned some new tricks in Ruby 2.7:

Support for muting different categories of compile warnings has been introduced. This is a mechanism on top of the warning level reflected by the $VERBOSE variable.

You can now silence deprecation warnings: These are aspects of the language which will be removed or changed in a future version of Ruby. One example is the infamous: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call. Since Ruby 3.0, deprecation warnings are not shown by default, so you will need to explicitly turn them on.

It is also possible to mute experimental features warnings: These are new features of Ruby, which might not have a stable API yet, like the new pattern matching

Per Ruby

Warning[:experimental] = false
Warning[:deprecated] = true


$ ruby -W:no-experimental
$ ruby -W:deprecated

Per ENV Variable

$ RUBYOPT="-W:no-experimental" ruby
$ RUBYOPT="-W:deprecated" ruby

Also See

More Idiosyncratic Ruby