Closed jpartlow closed 1 year ago
ideally we'd use ...
... PR welcome
(otherwise just *args, **kwargs, &block`)
I opened #491; looks like this could also be fixed with ::Kernel.send(:define_method, name.to_sym, ::FakeFS::Kernel.captives[:original][name].to_proc)
, but I don't know which approach is better.
looks good enough to me :)
On Fri, May 19, 2023 at 5:29 PM Josh Partlow @.***> wrote:
I opened #491 https://github.com/fakefs/fakefs/pull/491; looks like this could also be fixed with ::Kernel.send(:define_method, name.to_sym, ::FakeFS::Kernel.captives[:original][name].to_proc), but I don't know which approach is better.
— Reply to this email directly, view it on GitHub https://github.com/fakefs/fakefs/issues/490#issuecomment-1555396652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACYZYZNQ6JPUZPGRPESITXHAF77ANCNFSM6AAAAAAYIJSUF4 . You are receiving this because you commented.Message ID: @.***>
In Ruby3, after fakefs has hijacked Kernel.open, and then deactivated such that is once again delegating to the original Kernel.open, it can't handle passing of kwargs here in kernel.rb.
The issue is that in Ruby3 the positional and keyword args need to be separated. So for *args where args is something like ['a/file', {encoding: 'something'}], the kwargs hash ends up splatted as the second positional arg and you get a "fakefs/kernel.rb:22:in `initialize': no implicit conversion of Hash into String (TypeError)" error.
Example:
Given:
you'll get: