From: mail@... Date: 2016-02-02T13:57:31+00:00 Subject: [ruby-core:73650] [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. I think I should've been more specific and also should've mentioned that in the example above, the method you are trying to call doesn't actually exist. ```ruby begin self.method_that_does_not_exist rescue NoMethodError => e e.message # => undefined local variable or method `method_that_does_not_exist' ... e.private_method_callable? # => false end begin method_that_does_not_exist() rescue NoMethodError => e e.message # => undefined local variable or method `method_that_does_not_exist' ... e.private_method_callable? # => true end ``` So, I guess what I'm proposing here is adding a way to tell if a "fcall" could be made. ---------------------------------------- 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-56841 * 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: