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

ruby-changes:60159

From: Burdette <ko1@a...>
Date: Sat, 22 Feb 2020 10:26:10 +0900 (JST)
Subject: [ruby-changes:60159] af12e38675 (master): More ENV rdoc [ci skip]

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

From af12e38675a2cd927855079709d42666dd7bbf9c Mon Sep 17 00:00:00 2001
From: Burdette Lamar <BurdetteLamar@Y...>
Date: Fri, 21 Feb 2020 19:25:54 -0600
Subject: More ENV rdoc [ci skip]


diff --git a/hash.c b/hash.c
index 10923f6..9c723a0 100644
--- a/hash.c
+++ b/hash.c
@@ -4877,7 +4877,7 @@ env_delete(VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4877
  *   ENV['foo'] = '0'
  *   ENV.delete('foo') { |name| fail 'ignored' } # => "0"
  * Raises an exception if +name+ is invalid.
- * See {Invalid Names and Values}[#class-ENV-label-Invalid-Names+and+Values].
+ * See {Invalid Names and Values}[#class-ENV-label-Invalid+Names+and+Values].
  */
 static VALUE
 env_delete_m(VALUE obj, VALUE name)
@@ -4900,7 +4900,7 @@ env_delete_m(VALUE obj, VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4900
  *   ENV.clear
  *   ENV['foo'] # => nil
  * Raises an exception if +name+ is invalid.
- * See {Invalid Names and Values}[#class-ENV-label-Invalid-Names+and+Values].
+ * See {Invalid Names and Values}[#class-ENV-label-Invalid+Names+and+Values].
  */
 static VALUE
 rb_f_getenv(VALUE obj, VALUE name)
@@ -4938,7 +4938,7 @@ rb_f_getenv(VALUE obj, VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4938
  * and neither default value nor block is given:
  *   ENV.fetch('foo') # Raises KeyError (key not found: "foo")
  * Raises an exception if +name+ is invalid.
- * See {Invalid Names and Values}[#class-ENV-label-Invalid-Names+and+Values].
+ * See {Invalid Names and Values}[#class-ENV-label-Invalid+Names+and+Values].
  */
 static VALUE
 env_fetch(int argc, VALUE *argv, VALUE _)
@@ -5206,7 +5206,7 @@ ruby_unsetenv(const char *name) https://github.com/ruby/ruby/blob/trunk/hash.c#L5206
 
 /*
  * call-seq:
- *   ENV[name] = value -> value
+ *   ENV[name] = value      -> value
  *   ENV.store(name, value) -> value
  *
  * ENV.store is an alias for ENV.[]=.
@@ -5301,7 +5301,7 @@ env_keys(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L5301
 
 /*
  * call-seq:
- *   ENV.keys -> array
+ *   ENV.keys -> array of names
  *
  * Returns all variable names in an Array:
  *   ENV.replace('foo' => '0', 'bar' => '1')
@@ -5339,7 +5339,7 @@ rb_env_size(VALUE ehash, VALUE args, VALUE eobj) https://github.com/ruby/ruby/blob/trunk/hash.c#L5339
 /*
  * call-seq:
  *   ENV.each_key { |name| block } -> ENV
- *   ENV.each_key                  -> enumerator
+ *   ENV.each_key                  -> an_enumerator
  *
  * Yields each environment variable name:
  *   ENV.replace('foo' => '0', 'bar' => '1') # => ENV
@@ -5388,7 +5388,7 @@ env_values(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L5388
 
 /*
  * call-seq:
- *   ENV.values -> array
+ *   ENV.values -> array of values
  *
  * Returns all environment variable values in an Array:
  *   ENV.replace('foo' => '0', 'bar' => '1')
@@ -5409,7 +5409,7 @@ env_f_values(VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5409
 /*
  * call-seq:
  *   ENV.each_value { |value| block } -> ENV
- *   ENV.each_value                   -> enumerator
+ *   ENV.each_value                   -> an_enumerator
  *
  * Yields each environment variable value:
  *   ENV.replace('foo' => '0', 'bar' => '1') # => ENV
@@ -5440,9 +5440,9 @@ env_each_value(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5440
 /*
  * call-seq:
  *   ENV.each      { |name, value| block } -> ENV
- *   ENV.each                              -> enumerator
+ *   ENV.each                              -> an_enumerator
  *   ENV.each_pair { |name, value| block } -> ENV
- *   ENV.each_pair                         -> enumerator
+ *   ENV.each_pair                         -> an_enumerator
  *
  * Yields each environment variable name and its value as a 2-element Array:
  *   h = {}
@@ -5492,7 +5492,7 @@ env_each_pair(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5492
 /*
  * call-seq:
  *   ENV.reject! { |name, value| block } -> ENV or nil
- *   ENV.reject!                         -> enumerator
+ *   ENV.reject!                         -> an_enumerator
  *
  * Similar to ENV.delete_if, but returns +nil+ if no changes were made.
  *
@@ -5538,7 +5538,7 @@ env_reject_bang(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5538
 /*
  * call-seq:
  *   ENV.delete_if { |name, value| block } -> ENV
- *   ENV.delete_if                         -> enumerator
+ *   ENV.delete_if                         -> an_enumerator
  *
  * Yields each environment variable name and its value as a 2-element Array,
  * deleting each environment variable for which the block returns a truthy value,
@@ -5565,7 +5565,7 @@ env_delete_if(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5565
 
 /*
  * call-seq:
- *   ENV.values_at(*names) -> array
+ *   ENV.values_at(*names) -> array of values
  *
  * Returns an Array containing the environment variable values associated with
  * the given names:
@@ -5596,10 +5596,10 @@ env_values_at(int argc, VALUE *argv, VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5596
 
 /*
  * call-seq:
- *   ENV.select { |name, value| block } -> hash
- *   ENV.select                         -> enumerator
- *   ENV.filter { |name, value| block } -> hash
- *   ENV.filter                         -> enumerator
+ *   ENV.select { |name, value| block } -> hash of name/value pairs
+ *   ENV.select                         -> an_enumerator
+ *   ENV.filter { |name, value| block } -> hash of name/value pairs
+ *   ENV.filter                         -> an_enumerator
  *
  * ENV.filter is an alias for ENV.select.
  *
@@ -5642,9 +5642,9 @@ env_select(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5642
 /*
  * call-seq:
  *   ENV.select! { |name, value| block } -> ENV or nil
- *   ENV.select!                         -> enumerator
+ *   ENV.select!                         -> an_enumerator
  *   ENV.filter! { |name, value| block } -> ENV or nil
- *   ENV.filter!                         -> enumerator
+ *   ENV.filter!                         -> an_enumerator
  *
  * ENV.filter! is an alias for ENV.select!.
  *
@@ -5703,7 +5703,7 @@ env_select_bang(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5703
 /*
  * call-seq:
  *   ENV.keep_if { |name, value| block } -> ENV
- *   ENV.keep_if                         -> enumerator
+ *   ENV.keep_if                         -> an_enumerator
  *
  * Yields each environment variable name and its value as a 2-element Array,
  * deleting each environment variable for which the block returns +false+ or +nil+,
@@ -5727,12 +5727,16 @@ env_keep_if(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5727
 }
 
 /*
- *  call-seq:
- *     ENV.slice(*keys) -> a_hash
- *
- *  Returns a hash containing only the given keys from ENV and their values.
- *
- *     ENV.slice("TERM","HOME")  #=> {"TERM"=>"xterm-256color", "HOME"=>"/Users/rhc"}
+ * call-seq:
+ *   ENV.slice(*names) -> hash of name/value pairs
+ *
+ * Returns a Hash of the given ENV names and their corresponding values:
+ *   ENV.replace('foo' => '0', 'bar' => '1', 'baz' => '2', 'bat' => '3')
+ *   ENV.slice('foo', 'baz') # => {"foo"=>"0", "baz"=>"2"}
+ *   ENV.slice('baz', 'foo') # => {"baz"=>"2", "foo"=>"0"}
+ * Raises an exception if any of the +names+ is invalid
+ * (see {Invalid Names and Values}[#class-ENV-label-Invalid+Names+and+Values]):
+ *   ENV.slice('foo', 'bar', :bat) # Raises TypeError (no implicit conversion of Symbol into String)
  */
 static VALUE
 env_slice(int argc, VALUE *argv, VALUE _)
@@ -5803,7 +5807,7 @@ env_to_s(VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5807
 
 /*
  * call-seq:
- *   ENV.inspect -> string
+ *   ENV.inspect -> a_string
  *
  * Returns the contents of the environment as a String:
  *   ENV.replace('foo' => '0', 'bar' => '1')
@@ -5840,7 +5844,7 @@ env_inspect(VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5844
 
 /*
  * call-seq:
- *   ENV.to_a -> array
+ *   ENV.to_a -> array of 2-element arrays
  *
  * Returns the contents of ENV as an Array of 2-element Arrays,
  * each of which is a name/value pair:
@@ -5886,8 +5890,8 @@ env_none(VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5890
 
 /*
  * call-seq:
- *   ENV.length -> integer
- *   ENV.size   -> integer
+ *   ENV.length -> an_integer
+ *   ENV.size   -> an_integer
  *
  * Returns the count of environment variables:
  *   ENV.replace('foo' => '0', 'bar' => '1')
@@ -5968,7 +5972,7 @@ env_has_key(VALUE env, VALUE key) https://github.com/ruby/ruby/blob/trunk/hash.c#L5972
 
 /*
  * call-seq:
- *   ENV.assoc(name) -> array or nil
+ *   ENV.assoc(name) -> [name, value] or nil
  *
  * Returns a 2-element Array containing the name and value of the environment variable
  * for +name+ if it exists:
@@ -6000,7 +6004,7 @@ env_assoc(VALUE env, VALUE key) https://github.com/ruby/ruby/blob/trunk/hash.c#L6004
 
 /*
  * call-seq:
- *   ENV.value?(value) -> true or false
+ *   ENV.value?(value)     -> true or false
  *   ENV.has_value?(value) -> true or false
  *
  * Returns +true+ if +value+ is the value for some environment variable name, +false+ otherwise:
@@ -6035,7 +6039,7 @@ env_has_value(VALUE dmy, VALUE obj) https://github.com/ruby/ruby/blob/trunk/hash.c#L6039
 
 /*
  * call-seq:
- *   ENV.rassoc(value)
+ *   ENV.rassoc(value) -> [name, value] or nil
  *
  * Returns a 2-element Array containing the name and value of the
  * *first* *found* environment variable that has value +value+, if one
@@ -6091,7 +6095,7 @@ env_rassoc(VALUE dmy, VALUE obj) https://github.com/ruby/ruby/blob/trunk/hash.c#L6095
  *   ENV.key('2') # => nil
  * Raises an exception if +value+ is invalid:
  *   ENV.key(Object.new) # raises TypeError (no implicit conversion of Object into String)
- * See {Invalid Names and Values}[#class-ENV-label-Invalid-Names+and+Values].
+ * See {Invalid Names and Values}[#class-ENV-label-Invalid+Names+and+Values].
  */
 static VALUE
 env_key(VALUE dmy, VALUE value)
@@ -6119,7 +6123,7 @@ env_key(VALUE dmy, VALUE value) https://github.com/ruby/ruby (... truncated)

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

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