Skip to content

Instantly share code, notes, and snippets.

@erikh
Created April 6, 2012 10:31
Show Gist options
  • Save erikh/c7a3e82963bdc5ebcff4 to your computer and use it in GitHub Desktop.
Save erikh/c7a3e82963bdc5ebcff4 to your computer and use it in GitHub Desktop.
require 'warnings'
class Foo
include Warnings
def some_call
$-w = %w[ -shadowed ]
list = []
while true
list = 1 # no warning
end
end
# or this
def some_other_call
no_warn("shadowed") do
list = []
while true
list = 1 # no warning
end
end
end
# or this for explicitly requiring warnings
def some_new_call
warn("shadowed") do
list = []
while true
list = 1 # this warns
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment