summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-07 03:28:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-07 03:28:41 +0000
commitf69dff0ed11bea690e4b60f1ce9f7221a363fa46 (patch)
treec032de9c4bcfe5ffa2f11393181ee2c38d7c6dc9 /lib/irb
parentb82db5251c2c39f8a10cd21b595cc1cad8155cdc (diff)
* lib/irb/inspector.rb (IRB::INSPECTORS.def_inspector): support
object without #inspect defined. a patch from Daniel Bovensiepen. [ruby-core:25200] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/inspector.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/irb/inspector.rb b/lib/irb/inspector.rb
index c254ab58d6..ab5128399e 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -81,7 +81,13 @@ module IRB
end
INSPECTORS.def_inspector([false, :to_s, :raw]){|v| v.to_s}
- INSPECTORS.def_inspector([true, :p, :inspect]){|v| v.inspect}
+ INSPECTORS.def_inspector([true, :p, :inspect]){|v|
+ begin
+ v.inspect
+ rescue NoMethodError
+ puts "(Object doesn't support #inspect)"
+ end
+ }
INSPECTORS.def_inspector([:pp, :pretty_inspect], proc{require "pp"}){|v| v.pretty_inspect.chomp}
INSPECTORS.def_inspector([:yaml, :YAML], proc{require "yaml"}){|v|
begin