job_list .respond_to? updated to an instance method#830
job_list .respond_to? updated to an instance method#830taketo1113 merged 1 commit intojavan:mainfrom
.respond_to? updated to an instance method#830Conversation
|
ping @benlangfeld |
|
I am also affected by the issue @benlangfeld |
|
Hello @trungtran1512, do you have any idea about when this PR will be merged and when a new release will be cut? thanks |
|
Hello @crevete, I don't know about this but I tried under local it works fine. |
|
Hello @trungtran1512 who is the maintainer of this project? I guess @benlangfeld? Why he does never respond? Is this project dead? The code base is out-to-date... |
|
I think it shuold be fixed as - def self.respond_to?(name, include_private = false)
+ def respond_to?(name, include_private = false) |
lib/whenever/job_list.rb
Outdated
|
|
||
| def self.respond_to?(name, include_private = false) | ||
| @set_variables.has_key?(name) || super | ||
| if @set_variables |
There was a problem hiding this comment.
This will always be nil so this is effectively just super
Makes sense, I've updated the PR, thanks! |
|
@brunolarouche I would like to merge this Pull Request. Could you rebase it when you have a moment? Steps to reproduceI confirmed that the following issue is resolved: irb(main):001:0> require 'whenever'
=> true
irb(main):002:0> test
(irb):2:in `test': wrong number of arguments (given 0, expected 2..3) (ArgumentError)
from (irb):2:in `<main>'
from /Users/taketo/path/tmp/ruby/3.2.0/gems/irb-1.4.3/exe/irb:11:in `<top (required)>'
...
# input `test` & `[Tab]`
irb(main):003:0> testbundler: failed to load command: irb (/Users/taketo/path/tmp/ruby/3.2.0/bin/irb)
/Users/taketo/path/tmp/ruby/3.2.0/gems/whenever-1.0.0/lib/whenever/job_list.rb:41:in `respond_to?': undefined method `has_key?' for nil:NilClass (NoMethodError)
@set_variables.has_key?(name) || super
^^^^^^^^^
from /Users/taketo/path/tmp/ruby/3.2.0/gems/irb-1.4.3/lib/irb/completion.rb:364:in `block in retrieve_completion_data'
...
|
.respond_to? updated to an instance method
|
I have rebased and merged it. |
Sorry, I saw the message too late. Thanks for the rebase! |
|
The version 1.1.1 has been released. |
Since version 1.4.3 (ruby/irb@v1.4.3...master), irb ruby gem (https://github.com/ruby/irb) is calling directly "respond_to?" method on all included code inside a project. That change makes all code included in a project having that method crashing if implementing it in a way not always returning a true or false, like described in the ruby doc: https://www.rubydoc.info/stdlib/core/Object:respond_to%3F
So, I just wanted to propose that simple change which would prevent that (and maybe) other situations, now always returning a value. I've not used the Ruby '&' in order to be retro-compatible with pre-2.3 ruby versions, in case.