/ Published in: Ruby

You can turn off warnings for a section of your code by setting $VERBOSE to nil. Even better is to codify this in a method. Since this method takes a block as its parameter, you can now pass it arbitrary chunks of code to execute without warnings.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def silently(&block) warn_level = $VERBOSE $VERBOSE = nil result = block.call $VERBOSE = warn_level result end # e.g. silently { require 'net/https' }
URL: http://www.caliban.org/ruby/rubyguide.shtml
Comments
