Created
December 16, 2008 19:50
-
-
Save rkh/36765 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 foo; bar = "blah"; raise NotImplementedError; end | |
=> #<CompiledMethod foo file=(irb)> | |
>> def get_exception; begin; yield; nil; rescue Exception => e; e; end; end | |
=> #<CompiledMethod get_exception file=(irb)> | |
>> e = get_exception { foo } | |
=> #<NotImplementedError: NotImplementedError> | |
>> cx = e.context | |
=> #<MethodContext:0x16a main#foo (irb):1> | |
>> m = cx.method | |
=> #<CompiledMethod foo file=(irb)> | |
>> m.local_names | |
=> #<Tuple: :bar> | |
>> cx.get_eval_local :bar | |
=> nil | |
Shouldn't the last line return "blah"?? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment