Skip to content

Commit

Permalink
Suppress URI.open warning in Ruby 2.7
Browse files Browse the repository at this point in the history
This PR suppresses the follwoing warning in Ruby 2.7

```console
% ruby -v
ruby 2.7.0dev (2019-09-14T09:21:37Z master 39c37acf86) [x86_64-darwin17]
% bundle exec thor spec
(snip)

/Users/koic/src/github.com/erikhuda/thor/lib/ty
./Users/koic/src/github.com/erikhuda/thor/lib/thor/actions/file_manipulation.rb:89:
warning: calling URI.open via Kernel#open is deprecated, call URI.open directly
```

cf ruby/ruby@05aac90.
  • Loading branch information
koic committed Sep 15, 2019
1 parent edb975f commit aabc989
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/thor/actions/file_manipulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ def get(source, *args, &block)
config = args.last.is_a?(Hash) ? args.pop : {}
destination = args.first

if source =~ %r{^https?\://}
render = if source =~ %r{^https?\://}
require "open-uri"
URI.send(:open, source) { |input| input.binmode.read }
else
source = File.expand_path(find_in_source_paths(source.to_s))
open(source) { |input| input.binmode.read }
end

render = open(source) { |input| input.binmode.read }

destination ||= if block_given?
block.arity == 1 ? yield(render) : yield
else
Expand Down

0 comments on commit aabc989

Please sign in to comment.