Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rkh
Created February 21, 2014 07:45
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkh/9130314 to your computer and use it in GitHub Desktop.
Save rkh/9130314 to your computer and use it in GitHub Desktop.
Run Ruby with warnings enabled. Without going crazy.
require 'delegate'
module Support
class WarningFilter < DelegateClass(IO)
def write(line)
super if line !~ /^\S+gems\/ruby\-\S+:\d+: warning:/
end
end
end
$stderr = Support::WarningFilter.new($stderr)
@rkh
Copy link
Author

rkh commented Feb 21, 2014

Ah, no, it's not supposed to filter out these warnings. It's only supposed to filter out warnings coming from third-party gems. Note that you didn't run with -w in the first example.

@rtlong
Copy link

rtlong commented Feb 17, 2015

THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment