diff --git a/lib/pry/color_printer.rb b/lib/pry/color_printer.rb index 5f804fd1..39d9a9ae 100644 --- a/lib/pry/color_printer.rb +++ b/lib/pry/color_printer.rb @@ -37,8 +37,9 @@ class Pry # Read the class name off of the singleton class to provide a default # inspect. - eig = class << obj; self; end - klass = Pry::Method.safe_send(eig, :ancestors).first + singleton = class << obj; self; end + ancestors = Pry::Method.safe_send(singleton, :ancestors) + klass = ancestors.reject { |k| k == singleton }.first obj_id = obj.__id__.to_s(16) rescue 0 str = "#<#{klass}:0x#{obj_id}>"