ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:73630] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
@ 2016-02-01 12:22 ` mail
  2016-02-01 13:16 ` [ruby-core:73633] [Ruby trunk Feature#12043]Add " eregontp
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mail @ 2016-02-01 12:22 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been reported by Yuki Nishijima.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73633] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
  2016-02-01 12:22 ` [ruby-core:73630] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of mail
@ 2016-02-01 13:16 ` eregontp
  2016-02-02  1:54 ` [ruby-core:73641] " nobu
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: eregontp @ 2016-02-01 13:16 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Benoit Daloze.


Is respond_to?(no_method_error.name, false) not enough for this purpose?

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73641] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
  2016-02-01 12:22 ` [ruby-core:73630] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of mail
  2016-02-01 13:16 ` [ruby-core:73633] [Ruby trunk Feature#12043]Add " eregontp
@ 2016-02-02  1:54 ` nobu
  2016-02-02 13:02 ` [ruby-core:73646] " mail
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: nobu @ 2016-02-02  1:54 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Nobuyoshi Nakada.


I think he wants to distinguish `self.foo` and `foo()`.
Only public methods can be candidates in the former case, but also private methods can be in the latter case.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73646] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2016-02-02  1:54 ` [ruby-core:73641] " nobu
@ 2016-02-02 13:02 ` mail
  2016-02-02 13:14 ` [ruby-core:73647] " eregontp
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mail @ 2016-02-02 13:02 UTC (permalink / raw
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73647] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2016-02-02 13:02 ` [ruby-core:73646] " mail
@ 2016-02-02 13:14 ` eregontp
  2016-02-02 13:57 ` [ruby-core:73650] " mail
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: eregontp @ 2016-02-02 13:14 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Benoit Daloze.


So this would essentially be a way to tell if the call was a "fcall", without needing to parse the exception message?
In other terms, telling if this NoMethodError is a "private method called" error.
Maybe exc.private_method_error? or exc.private_method_called?


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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73650] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2016-02-02 13:14 ` [ruby-core:73647] " eregontp
@ 2016-02-02 13:57 ` mail
  2016-02-02 14:09 ` [ruby-core:73651] " eregontp
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mail @ 2016-02-02 13:57 UTC (permalink / raw
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73651] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2016-02-02 13:57 ` [ruby-core:73650] " mail
@ 2016-02-02 14:09 ` eregontp
  2016-02-02 14:17 ` [ruby-core:73652] " usa
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: eregontp @ 2016-02-02 14:09 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Benoit Daloze.


The first error message is actually
"undefined method `method_that_does_not_exist' for main:Object".
But that does not help since anyway the error message below would be the same since it has "()" (and the same problem if it would have arguments)

"private_method_callable?" sounds like a specific private method would be callable.

Maybe e.private_call?
"Returns true if the call which generated the error was allowed to call private methods (because it had no receiver, was using self.assign= or used #send)"

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73652] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2016-02-02 14:09 ` [ruby-core:73651] " eregontp
@ 2016-02-02 14:17 ` usa
  2016-02-02 14:30 ` [ruby-core:73653] " mail
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: usa @ 2016-02-02 14:17 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Usaku NAKAMURA.


Does it satisfy your use case that raising another exception when private method call with `self.` ?

```ruby
begin
  self.a_private_method
rescue NoMethodError => e
  e.is_a? PrivateMethodCallError #=> true
end

begin
  self.method_not_exist
rescue NoMethodError => e
  e.is_a? PrivateMethodCallError #=> false
end
  
begin
  method_not_exist
rescue NoMethodError => e
  e.is_a? PrivateMethodCallError #=> false
end
```

Of course, `PrivateMethodCallError` inherits from `NoMethodError`.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73653] [Ruby trunk Feature#12043]Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2016-02-02 14:17 ` [ruby-core:73652] " usa
@ 2016-02-02 14:30 ` mail
  2016-02-03  7:40 ` [ruby-core:73667] [Ruby trunk Feature#12043] Add " nobu
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: mail @ 2016-02-02 14:30 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Yuki Nishijima.


Benoit, you are absolutely right about the error message. I was a bad person and didn't really check after copying & pasting...
Regarding the method name, `#private_call?` sounds better to me than `private_method_callable?`.

Nakamura-san, sorry I wasn't clear enough in the first place. It would be great if you could read the further explanation I posted above.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73667] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2016-02-02 14:30 ` [ruby-core:73653] " mail
@ 2016-02-03  7:40 ` nobu
  2016-02-07 12:47 ` [ruby-core:73732] " shevegen
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: nobu @ 2016-02-03  7:40 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Nobuyoshi Nakada.


https://github.com/ruby/ruby/compare/trunk...nobu:feature/12043-NoMethodError%23private_call-p

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73732] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2016-02-03  7:40 ` [ruby-core:73667] [Ruby trunk Feature#12043] Add " nobu
@ 2016-02-07 12:47 ` shevegen
  2016-02-19  2:20 ` [ruby-core:73884] " nobu
  2016-02-26 10:00 ` [ruby-core:74006] " eregontp
  12 siblings, 0 replies; 13+ messages in thread
From: shevegen @ 2016-02-07 12:47 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Robert A. Heiler.


Good suggestion IMHO, +1

The did_you_mean gem is great. If distinguishing between "()" and no "" will
make things even greater then I am all for it. \o/

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:73884] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2016-02-07 12:47 ` [ruby-core:73732] " shevegen
@ 2016-02-19  2:20 ` nobu
  2016-02-26 10:00 ` [ruby-core:74006] " eregontp
  12 siblings, 0 replies; 13+ messages in thread
From: nobu @ 2016-02-19  2:20 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Nobuyoshi Nakada.


This feature is **only** for "did_you_mean" gem, so I think that any name is OK, including implementation details.

`private_call?`
`explicit_receiver?`
`fcall?`
`were_you_a_function?`
`demon_from_the_nose?`
etc.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:74006] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of
       [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
                   ` (11 preceding siblings ...)
  2016-02-19  2:20 ` [ruby-core:73884] " nobu
@ 2016-02-26 10:00 ` eregontp
  12 siblings, 0 replies; 13+ messages in thread
From: eregontp @ 2016-02-26 10:00 UTC (permalink / raw
  To: ruby-core

Issue #12043 has been updated by Benoit Daloze.


Nobuyoshi Nakada wrote:
> This feature is **only** for "did_you_mean" gem, so I think that any name is OK, including implementation details.
> 
> `private_call?`
> `explicit_receiver?`
> `fcall?`
> `were_you_a_function?`
> `demon_from_the_nose?`
> etc.

It's still public API.

Let's choose `private_call?`, since I and the OP agree on this, unless somebody has an objection.

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

* 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/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-02-26  9:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-12043.20160201122218@ruby-lang.org>
2016-02-01 12:22 ` [ruby-core:73630] [Ruby trunk Feature#12043] Add a method to NoMethodError that tells if private methods are callable at the time of mail
2016-02-01 13:16 ` [ruby-core:73633] [Ruby trunk Feature#12043]Add " eregontp
2016-02-02  1:54 ` [ruby-core:73641] " nobu
2016-02-02 13:02 ` [ruby-core:73646] " mail
2016-02-02 13:14 ` [ruby-core:73647] " eregontp
2016-02-02 13:57 ` [ruby-core:73650] " mail
2016-02-02 14:09 ` [ruby-core:73651] " eregontp
2016-02-02 14:17 ` [ruby-core:73652] " usa
2016-02-02 14:30 ` [ruby-core:73653] " mail
2016-02-03  7:40 ` [ruby-core:73667] [Ruby trunk Feature#12043] Add " nobu
2016-02-07 12:47 ` [ruby-core:73732] " shevegen
2016-02-19  2:20 ` [ruby-core:73884] " nobu
2016-02-26 10:00 ` [ruby-core:74006] " eregontp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).