class BindingDumper::CoreExt::MagicContextPatchBuilder
Attributes
undumped[R]
Public Class Methods
new(undumped)
click to toggle source
# File lib/binding_dumper/core_ext/magic_context_patch_builder.rb, line 30 def initialize(undumped) @undumped = undumped end
Public Instance Methods
patch()
click to toggle source
Returns module that is ready for patching existing context
@return [Module]
# File lib/binding_dumper/core_ext/magic_context_patch_builder.rb, line 38 def patch undumped = self.undumped Module.new do define_method :_local_binding do result = binding undumped[:lvars].each do |lvar_name, lvar| result.eval("#{lvar_name} = ObjectSpace._id2ref(#{lvar.object_id})") end mod = LocalBindingPatchBuilder.new(undumped).patch result.extend(mod) end end end