Skip to content

Commit

Permalink
Use URI.send in apply action to work in Ruby 3
Browse files Browse the repository at this point in the history
In Ruby 3.0.0-preview2, I get the error `No such file or directory @ rb_sysopen` when using the `apply` action with a remote URL. By changing the use of `open` to `URI.send(:open …)`, it works in Ruby 3 while preserving backwards-compatibility (this is already how it's done in the `get` file manipulation method).
  • Loading branch information
jaredcwhite committed Dec 22, 2020
1 parent 34df888 commit e6c89b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/thor/actions.rb
Expand Up @@ -219,7 +219,7 @@ def apply(path, config = {})

contents = if is_uri
require "open-uri"
open(path, "Accept" => "application/x-thor-template", &:read)
URI.send(:open, path, "Accept" => "application/x-thor-template", &:read)
else
open(path, &:read)
end
Expand Down

0 comments on commit e6c89b2

Please sign in to comment.