diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-06-30 21:04:56 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-06-30 21:06:52 +0900 |
commit | acbddbe68cdcf5506791d8e19c184536ba253b02 (patch) | |
tree | 37071260af8f7a04cafabf4e172101d1ab1db1f6 | |
parent | e8c2b03ee145e10217a8ed58dbadfe30f9edbdfe (diff) |
[ruby/irb] Rescue a specific error
Rescuing StandardError is prone to bugs caused by a typo or obsoleted methods.
https://github.com/ruby/irb/commit/eb5260fcd5
-rw-r--r-- | lib/irb/cmd/ls.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/cmd/ls.rb b/lib/irb/cmd/ls.rb index 9cbba50f10..18092642d7 100644 --- a/lib/irb/cmd/ls.rb +++ b/lib/irb/cmd/ls.rb @@ -24,7 +24,7 @@ module IRB end def dump_methods(o, klass, obj) - singleton_class = obj.singleton_class rescue nil + singleton_class = begin obj.singleton_class; rescue TypeError; nil end maps = class_method_map((singleton_class || klass).ancestors) maps.each do |mod, methods| name = mod == singleton_class ? "#{klass}.methods" : "#{mod}#methods" |