class Binding
Public Instance Methods
of_callers()
click to toggle source
# File lib/binding_of_callers.rb, line 7 def of_callers enhance do |bi| BindingOfCallers::Revealed.new bi end end
of_callers!()
click to toggle source
# File lib/binding_of_callers.rb, line 13 def of_callers! enhance do |bi| bi.extend BindingOfCallers::Reveal end end
pry(object=nil, hash={})
click to toggle source
# File lib/binding_of_callers/pry.rb, line 5 def pry(object=nil, hash={}) bs = of_callers!.tap &:shift bs_indexed = bs.each_with_object({}){|b, h| h[h.keys.count] = b} Pry.hooks.add_hook :when_started, "original_binding_stack_#{object_id}" do |target, options, pry_self| pry_self.inject_local :_bs_, bs, pry_self.current_binding pry_self.inject_local :_bsi_, bs_indexed, pry_self.current_binding end Pry.start self end
Private Instance Methods
collected()
click to toggle source
# File lib/binding_of_callers.rb, line 25 def collected n = 3 bis = [] while n < frame_count bis << of_caller(n) n = n.succ end bis end
enhance(&enhance)
click to toggle source
# File lib/binding_of_callers.rb, line 21 def enhance &enhance collected.map(&enhance) end