I'm assuming the Pathname object implements the write method, so this error is mistakenly thrown. Casting the Pathname object to a string fixes the issue, but this was rather hard to debug since the error message was about using an in-memory buffer.
To reproduce,
download! "some/path", Pathname.new("/some/other/path").parent, {
recursive: true
}
To fix,
download! "some/path", Pathname.new("/some/other/path").parent.to_s, {
recursive: true
}
What if we automatically perform a to_s on Pathname objects to catch this?
I'm assuming the
Pathnameobject implements thewritemethod, so this error is mistakenly thrown. Casting thePathnameobject to a string fixes the issue, but this was rather hard to debug since the error message was about using an in-memory buffer.To reproduce,
To fix,
What if we automatically perform a
to_sonPathnameobjects to catch this?