Created
February 22, 2018 06:04
-
-
Save hanachin/63630afd72d5648ea7d05ba64f68f2c5 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
def f(x) | |
if x | |
unless x | |
p :foo | |
end | |
end | |
end | |
TracePoint.trace(:line) do |tp| | |
if tp.lineno == 2 | |
tp.binding.local_variable_set(:x, true) | |
end | |
if tp.lineno == 3 | |
tp.binding.local_variable_set(:x, false) | |
end | |
end | |
f("whatever") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment