Skip to content

Instantly share code, notes, and snippets.

@tgxworld
Last active August 29, 2015 14:18
Show Gist options
  • Save tgxworld/c1f0ba82a2d1a5bedf2e to your computer and use it in GitHub Desktop.
Save tgxworld/c1f0ba82a2d1a5bedf2e to your computer and use it in GitHub Desktop.
Interpolate Regexp expression.
{
["/home/guoxiang/work/rails-dev-box/rails/actionpack/lib/action_controller/metal/test.rb", 8, :T_ARRAY]=>[1, 0, 0, 0, 0, 0],
["/home/guoxiang/work/rails-dev-box/rails/actionpack/lib/action_controller/metal/test.rb", 8, :T_STRING]=>[6, 0, 0, 0, 0, 0],
["/home/guoxiang/work/rails-dev-box/rails/actionpack/lib/action_controller/metal/test.rb", 8, :T_REGEXP]=>[1, 0, 0, 0, 0, 0]
}
require 'objspace'
require 'allocation_tracer'
require 'pp'
ObjectSpace::AllocationTracer.setup(%i{path line type})
a = "asd"
result = ObjectSpace::AllocationTracer.trace do
/#{a}/
end
pp result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment