From: mail@... Date: 2016-02-02T13:02:09+00:00 Subject: [ruby-core:73646] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of Issue #12043 has been updated by Yuki Nishijima. Nakada-san, that's exactly what I want. A code example would be something like this: ```ruby begin self.do_something rescue NoMethodError => no_method_error no_method_error.private_method_callable? # => false end begin do_something() rescue NoMethodError => no_method_error no_method_error.private_method_callable? # => true end ``` In the first `begin...end` part, you call `self.` first, so you can't call private methods while you can in the second one. ---------------------------------------- Feature #12043: Add a method to NoMethodError that tells if private methods are callable at the time of https://bugs.ruby-lang.org/issues/12043#change-56837 * Author: Yuki Nishijima * Status: Open * Priority: Normal * Assignee: ---------------------------------------- I've briefly talked about this to Sasada-san, but also wanted to hear from other committers. I would like to add a method to `NoMethodError` that tells whether or not private methods are callable from the line where the exception is raised. An example would be like this: ```ruby begin raies "Error" # rescue NoMethodError => no_method_error no_method_error.private_method_callable? # => true end ``` The only use case I can think of is [the spell checker in the did_you_mean gem](https://github.com/yuki24/did_you_mean/blob/c4f0247/lib/did_you_mean/spell_checkers/method_name_checker.rb#L18) and I'm not actually sure how useful it would be for others. Please let me know what you think, I'm open to suggestions. -- https://bugs.ruby-lang.org/ Unsubscribe: