Is there a way to disable the Ruby ban warning in 2.4.0?

Starting with Ruby 2.4.0, there was an obsolescence warning to use certain functions that were obsolete. For example, Bignum , Fixnum , TRUE and FALSE will cause obsolescence warnings. Although I am correcting my code, there is enough code for which I would like to disable it, especially in Rails. How can i do this?

+5
source share
1 answer
 module Kernel def suppress_warnings original_verbosity = $VERBOSE $VERBOSE = nil result = yield $VERBOSE = original_verbosity return result end end >> X = :foo => :foo >> X = :bar (irb):11: warning: already initialized constant X => :bar >> suppress_warnings { X = :baz } => :baz 
+3
source

Source: https://habr.com/ru/post/1262823/


All Articles