From: kigster@... Date: 2017-08-22T21:35:29+00:00 Subject: [ruby-core:82451] [Ruby trunk Bug#13835] Using 'open-uri' with 'tempfile' causes an exception Issue #13835 has been updated by kigster (Konstantin Gredeskoul). shevegen (Robert A. Heiler) wrote: > Indeed, sounds like a bug; at the least it is somewhat surprising behaviour to me. Not > that I think I would have ever found the above behaviour, I always used open-uri with > a remote URL so far. :) Wait, is the first argument to open should be a string/path? Ie, changing this to `open(temp_file.path, 'a'` works for me. ---------------------------------------- Bug #13835: Using 'open-uri' with 'tempfile' causes an exception https://bugs.ruby-lang.org/issues/13835#change-66260 * Author: thorsteneckel (Thorsten Eckel) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Hi there, try this in your current ruby env: ~~~ ruby require 'tempfile' require 'open-uri' temp_file = Tempfile.new open(temp_file, 'a') ~~~ Get this: ~~~ /Users/~/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tempfile.rb:142:in `open': wrong number of arguments (given 1, expected 0) (ArgumentError) from /Users/~/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/open-uri.rb:31:in `open' from debug.rb:5:in `
' ~~~ I created the pull request https://github.com/ruby/ruby/pull/1680 as a proposal. It's based on the previous pull request https://github.com/ruby/ruby/pull/1675 and feedback of @nobu . Greetings. -- https://bugs.ruby-lang.org/ Unsubscribe: