In: |
pp.rb
|
InspectKey | = | :__inspect_key__ |
# File pp.rb, line 160 def guard_inspect_key if Thread.current[InspectKey] == nil Thread.current[InspectKey] = [] end save = Thread.current[InspectKey] begin Thread.current[InspectKey] = [] yield ensure Thread.current[InspectKey] = save end end
# File pp.rb, line 175 def pp(obj) id = obj.__id__ if Thread.current[InspectKey].include? id group {obj.pretty_print_cycle self} return end begin Thread.current[InspectKey] << id group {obj.pretty_print self} ensure Thread.current[InspectKey].pop unless PP.sharing_detection end end
# File pp.rb, line 191 def object_group(obj, &block) group(1, '#<' + obj.class.name, '>', &block) end
# File pp.rb, line 195 def object_address_group(obj, &block) group(1, sprintf('#<%s:0x%x', obj.class.to_s, obj.__id__ * 2), '>', &block) end
# File pp.rb, line 204 def pp_object(obj) object_address_group(obj) { obj.pretty_print_instance_variables.each {|v| v = v.to_s if Symbol === v text ',' unless first? breakable text v text '=' group(1) { breakable '' pp(obj.instance_eval(v)) } } } end