Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated Pry.view_clip() again, this time calling #inspect on nil, tru…

…e, false as well. Also truncted #<> syntax to exclude memory address to improve appearance of prompts
  • Loading branch information...
commit 1759f282f495b954225da649aef308a8ee2ac6d7 1 parent a2b950d
@banister banister authored
Showing with 4 additions and 2 deletions.
  1. +2 −0  CHANGELOG
  2. +2 −2 lib/pry/pry_class.rb
View
2  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)
View
4 lib/pry/pry_class.rb
@@ -106,10 +106,10 @@ def self.view_clip(obj, max_length = 60)
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
Please sign in to comment.
Something went wrong with that request. Please try again.