-
-
Save jc00ke/1439994 to your computer and use it in GitHub Desktop.
Want to look at the code a block would run when called?
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
~ maglev ✔ maglev-irb -f | |
irb(main):001:0> b = proc { p 1 } | |
=> #<Proc> | |
irb(main):002:0> b.instance_variable_get("@_st_block") | |
=> #<ExecBlock:0x561a6201 | |
irb(main):003:0> block = b.instance_variable_get("@_st_block") | |
=> #<ExecBlock:0x561a6201 | |
irb(main):004:0> block.class | |
=> ExecBlock | |
irb(main):005:0> block.class.primitive '_sourceString', '_sourceString' | |
=> ExecBlock | |
irb(main):006:0> block._sourceString | |
=> "\"This is source for a block. \" \n ^ { p 1 }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment