[前][次][番号順一覧][スレッド一覧]

ruby-changes:64840

From: Kazuhiro <ko1@a...>
Date: Tue, 12 Jan 2021 22:18:17 +0900 (JST)
Subject: [ruby-changes:64840] 344a824ef9 (master): [DOC] Use URI#read instead of URI.open for better compatibility

https://git.ruby-lang.org/ruby.git/commit/?id=344a824ef9

From 344a824ef9d4b6152703d02d7ffa042abd4252c1 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Tue, 12 Jan 2021 22:12:02 +0900
Subject: [DOC] Use URI#read instead of URI.open for better compatibility

- URI.open is available since 2.5.0, but URI#read is available since 1.8.0.
- Fix `open` without `close`.
- ref https://github.com/rurema/doctree/pull/2433

diff --git a/kernel.rb b/kernel.rb
index 4f7f6a3..de20fff 100644
--- a/kernel.rb
+++ b/kernel.rb
@@ -105,7 +105,7 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/kernel.rb#L105
   #     require 'json'
   #
   #     construct_url(arguments).
-  #       then {|url| URI.open(url).read }.
+  #       then {|url| URI(url).read }.
   #       then {|response| JSON.parse(response) }
   #
   #  When called without block, the method returns +Enumerator+,
@@ -138,7 +138,7 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/kernel.rb#L138
   #     require 'json'
   #
   #     construct_url(arguments).
-  #       then {|url| URI.open(url).read }.
+  #       then {|url| URI(url).read }.
   #       then {|response| JSON.parse(response) }
   #
   def yield_self
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]