From 391ee3ee3acb2553b5ae7817373eaf3fce891e07 Mon Sep 17 00:00:00 2001 From: Masataka Pocke Kuwabara Date: Fri, 8 Jan 2021 23:52:35 +0900 Subject: [PATCH] Replace `Kernel.#open` with `URI.open` in doc Because `Kernel.#open` no longer opens URI since Ruby 3.0. --- enumerator.c | 4 ++-- kernel.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enumerator.c b/enumerator.c index 6d6a588af9..08d08ecc2e 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1711,13 +1711,13 @@ lazy_generator_init(VALUE enumerator, VALUE procs) * * # 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 04a371a7c8..4f7f6a38ca 100644 --- a/kernel.rb +++ b/kernel.rb @@ -105,7 +105,7 @@ module Kernel # 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 # require 'json' # # construct_url(arguments). - # then {|url| open(url).read }. + # then {|url| URI.open(url).read }. # then {|response| JSON.parse(response) } # def yield_self