1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

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

This commit is contained in:
John Mair 2011-09-08 18:30:23 +12:00
parent a2b950df7e
commit 1759f282f4
2 changed files with 4 additions and 2 deletions

View file

@ -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 file

@ -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