Inspecting the source code of required files in ruby

Everybody after using require in ruby wonders: “How I can see the source that was loaded?”(ok, ok, not everybody).  And thank god it does not need any type of black magic. Only a variable called SCRIPT_LINES__ defined as a hash.

Here the file that we’ll require.

And here our code that will load it.

Leave a Reply