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

ruby-changes:64801

From: Masataka <ko1@a...>
Date: Sat, 9 Jan 2021 00:31:49 +0900 (JST)
Subject: [ruby-changes:64801] 391ee3ee3a (master): Replace `Kernel.#open` with `URI.open` in doc

https://git.ruby-lang.org/ruby.git/commit/?id=391ee3ee3a

From 391ee3ee3acb2553b5ae7817373eaf3fce891e07 Mon Sep 17 00:00:00 2001
From: Masataka Pocke Kuwabara <kuwabara@p...>
Date: Fri, 8 Jan 2021 23:52:35 +0900
Subject: Replace `Kernel.#open` with `URI.open` in doc

Because `Kernel.#open` no longer opens URI since Ruby 3.0.

diff --git a/enumerator.c b/enumerator.c
index 6d6a588..08d08ec 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -1711,13 +1711,13 @@ lazy_generator_init(VALUE enumerator, VALUE procs) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L1711
  *
  *    # This will fetch all URLs before selecting
  *    # necessary data
- *    URLS.map { |u| JSON.parse(open(u).read) }
+ *    URLS.map { |u| JSON.parse(URI.open(u).read) }
  *      .select { |data| data.key?('stats') }
  *      .first(5)
  *
  *    # This will fetch URLs one-by-one, only till
  *    # there is enough data to satisfy the condition
- *    URLS.lazy.map { |u| JSON.parse(open(u).read) }
+ *    URLS.lazy.map { |u| JSON.parse(URI.open(u).read) }
  *      .select { |data| data.key?('stats') }
  *      .first(5)
  *
diff --git a/kernel.rb b/kernel.rb
index 04a371a..4f7f6a3 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| open(url).read }.
+  #       then {|url| URI.open(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| open(url).read }.
+  #       then {|url| URI.open(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/

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