Skip to content

Instantly share code, notes, and snippets.

@giruzou
Forked from hanachin/ruby_is_awesome.rb
Created February 23, 2018 10:38
Show Gist options
  • Save giruzou/d6a4bf36fbbc5d255546c01a040cad9c to your computer and use it in GitHub Desktop.
Save giruzou/d6a4bf36fbbc5d255546c01a040cad9c to your computer and use it in GitHub Desktop.
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