Skip to content

Commit 8a70478

Browse files
authored
[DOC] Fix outdated ENV::clone method description
It does raise an exception rather than just issuing a warning: ```shell $ docker run -e ALL_RUBY_SINCE=2.7 --rm rubylang/all-ruby ./all-ruby -We 'ENV.clone' ruby-2.7.0 ... ruby-3.0.7 ruby-3.1.0-preview1 -e:1: warning: ENV.clone is deprecated; use ENV.to_h instead ... ruby-3.2.0-preview1 -e:1: warning: ENV.clone is deprecated; use ENV.to_h instead ruby-3.2.0-preview2 -e:1:in `clone': Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash (TypeError) from -e:1:in `<main>' exit 1 ... ruby-3.3.9 -e:1:in `clone': Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash (TypeError) from -e:1:in `<main>' exit 1 ruby-3.4.0-preview1 -e:1:in 'clone': Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash (TypeError) from -e:1:in '<main>' exit 1 ... ruby-3.5.0-preview1 -e:1:in 'clone': Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash (TypeError) from -e:1:in '<main>' exit 1 ```
1 parent 5b5b5b3 commit 8a70478

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7610,7 +7610,7 @@ Init_Hash(void)
76107610
*
76117611
* - ::assoc: Returns a 2-element array containing the name and value
76127612
* of the named environment variable if it exists:
7613-
* - ::clone: Returns +ENV+ (and issues a warning).
7613+
* - ::clone: Raises an exception.
76147614
* - ::except: Returns a hash of all name/value pairs except those given.
76157615
* - ::fetch: Returns the value for the given name.
76167616
* - ::inspect: Returns the contents of +ENV+ as a string.

0 commit comments

Comments
 (0)