From 1759f282f495b954225da649aef308a8ee2ac6d7 Mon Sep 17 00:00:00 2001 From: John Mair Date: Thu, 8 Sep 2011 18:30:23 +1200 Subject: [PATCH] updated Pry.view_clip() again, this time calling #inspect on nil, true, false as well. Also truncted #<> syntax to exclude memory address to improve appearance of prompts --- CHANGELOG | 2 ++ lib/pry/pry_class.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 792f1797..dce19b14 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,6 +34,8 @@ * added Pry::NAV_PROMPT (great new navigation prompt, per robgleeson) and Pry::SIMPLE_PRINT for simple (IRB-style) print output (just using inspect) * _pry_ now passed as 3rd parameter to :before_session hook * ls colors now configurable via Pry.config.ls.local_var_color = :bright_red etc +* ls separator configurable via, e.g Pry.config.ls.separator = " " +* Pry.view_clip() now only calls inspect on a few immediates, otherwise uses the #<> syntax, which has been truncated further to exclude teh mem address, again related to #245 */7/2011 version 0.9.3 * cat --ex (cats 5 lines above and below line in file where exception was raised) diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 89cab76e..9a62289d 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -106,10 +106,10 @@ class Pry elsif TOPLEVEL_BINDING.eval('self') == obj # special case for 'main' object :) obj.inspect - elsif [String, Numeric, Symbol].any? { |v| v === obj } && obj.inspect.length <= max_length + elsif [String, Numeric, Symbol, nil, true, false].any? { |v| v === obj } && obj.inspect.length <= max_length obj.inspect else - "#<#{obj.class}:%#x>" % (obj.object_id << 1) + "#<#{obj.class}>"#:%x>"# % (obj.object_id << 1) end rescue RescuableException