diff --git a/lib/pry.rb b/lib/pry.rb index 61afea6e..c558b3df 100644 --- a/lib/pry.rb +++ b/lib/pry.rb @@ -65,7 +65,7 @@ class Pry } ] - DEFAULT_PROMPT_SAFE_OBJECTS = [String, Numeric, Symbol, nil, true, false, TOPLEVEL_BINDING.eval("self")] + DEFAULT_PROMPT_SAFE_OBJECTS = [String, Numeric, Symbol, nil, true, false] # A simple prompt - doesn't display target or nesting level SIMPLE_PROMPT = [proc { ">> " }, proc { " | " }] diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 6edd734d..d5099722 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -130,11 +130,15 @@ class Pry def self.view_clip(obj, max_length = 60) if obj.kind_of?(Module) && obj.name.to_s != "" && obj.name.to_s.length <= max_length obj.name.to_s + elsif TOPLEVEL_BINDING.eval('self') == obj + # special case for 'main' object :) + obj.to_s elsif Pry.config.prompt_safe_objects.any? { |v| v === obj } && obj.inspect.length <= max_length obj.inspect else "#<#{obj.class}>"#:%x>"# % (obj.object_id << 1) end + rescue RescuableException "unknown" end