-
-
Save erikh/c7a3e82963bdc5ebcff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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