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

ruby-changes:71695

From: Burdette <ko1@a...>
Date: Tue, 12 Apr 2022 05:23:40 +0900 (JST)
Subject: [ruby-changes:71695] de5aa98f39 (master): Correct whitespace in array.c (#5791)

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

From de5aa98f396cfe900b456e78a9c451ac8a2a3e97 Mon Sep 17 00:00:00 2001
From: Burdette Lamar <BurdetteLamar@Y...>
Date: Mon, 11 Apr 2022 15:23:25 -0500
Subject: Correct whitespace in array.c (#5791)

---
 array.c | 380 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 370 insertions(+), 10 deletions(-)

diff --git a/array.c b/array.c
index bc904ec420..9bb767d79f 100644
--- a/array.c
+++ b/array.c
@@ -693,6 +693,7 @@ ary_ensure_room_for_push(VALUE ary, long add_len) https://github.com/ruby/ruby/blob/trunk/array.c#L693
  *    array.freeze -> self
  *
  *  Freezes +self+; returns +self+:
+ *
  *    a = []
  *    a.frozen? # => false
  *    a.freeze
@@ -1132,6 +1133,7 @@ rb_ary_s_new(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/array.c#L1133
  *
  *  With no block and a single \Array argument +array+,
  *  returns a new \Array formed from +array+:
+ *
  *    a = Array.new([:foo, 'bar', 2])
  *    a.class # => Array
  *    a # => [:foo, "bar", 2]
@@ -1139,12 +1141,14 @@ rb_ary_s_new(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/array.c#L1141
  *  With no block and a single \Integer argument +size+,
  *  returns a new \Array of the given size
  *  whose elements are all +nil+:
+ *
  *    a = Array.new(3)
  *    a # => [nil, nil, nil]
  *
  *  With no block and arguments +size+ and +default_value+,
  *  returns an \Array of the given size;
  *  each element is that same +default_value+:
+ *
  *    a = Array.new(3, 'x')
  *    a # => ['x', 'x', 'x']
  *
@@ -1152,6 +1156,7 @@ rb_ary_s_new(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/array.c#L1156
  *  returns an \Array of the given size;
  *  the block is called with each successive integer +index+;
  *  the element for that +index+ is the return value from the block:
+ *
  *    a = Array.new(3) {|index| "Element #{index}" }
  *    a # => ["Element 0", "Element 1", "Element 2"]
  *
@@ -1388,13 +1393,16 @@ ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos https://github.com/ruby/ruby/blob/trunk/array.c#L1393
  *    array << object -> self
  *
  *  Appends +object+ to +self+; returns +self+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a << :baz # => [:foo, "bar", 2, :baz]
  *
  *  Appends +object+ as one element, even if it is another \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a1 = a << [3, 4]
  *    a1 # => [:foo, "bar", 2, [3, 4]]
+ *
  */
 
 VALUE
@@ -1427,10 +1435,12 @@ rb_ary_cat(VALUE ary, const VALUE *argv, long len) https://github.com/ruby/ruby/blob/trunk/array.c#L1435
  *  Appends trailing elements.
  *
  *  Appends each argument in +objects+ to +self+;  returns +self+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
  *
  *  Appends each argument as one element, even if it is another \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a1 = a.push([:baz, :bat], [:bam, :bad])
  *    a1 # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
@@ -1474,6 +1484,7 @@ rb_ary_pop(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1484
  *
  *  When no argument is given and +self+ is not empty,
  *  removes and returns the last element:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.pop # => 2
  *    a # => [:foo, "bar"]
@@ -1481,12 +1492,14 @@ rb_ary_pop(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1492
  *  Returns +nil+ if the array is empty.
  *
  *  When a non-negative \Integer argument +n+ is given and is in range,
+ *
  *  removes and returns the last +n+ elements in a new \Array:
  *    a = [:foo, 'bar', 2]
  *    a.pop(2) # => ["bar", 2]
  *
  *  If +n+ is positive and out of range,
  *  removes and returns all elements:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.pop(50) # => [:foo, "bar", 2]
  *
@@ -1535,6 +1548,7 @@ rb_ary_shift(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1548
  *  Removes and returns leading elements.
  *
  *  When no argument is given, removes and returns the first element:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.shift # => :foo
  *    a # => ['bar', 2]
@@ -1543,12 +1557,14 @@ rb_ary_shift(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1557
  *
  *  When positive \Integer argument +n+ is given, removes the first +n+ elements;
  *  returns those elements in a new \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.shift(2) # => [:foo, 'bar']
  *    a # => [2]
  *
  *  If +n+ is as large as or larger than <tt>self.length</tt>,
  *  removes all elements; returns those elements in a new \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.shift(3) # => [:foo, 'bar', 2]
  *
@@ -1698,6 +1714,7 @@ ary_ensure_room_for_unshift(VALUE ary, int argc) https://github.com/ruby/ruby/blob/trunk/array.c#L1714
  *    array.unshift(*objects) -> self
  *
  *  Prepends the given +objects+ to +self+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.unshift(:bam, :bat) # => [:bam, :bat, :foo, "bar", 2]
  *
@@ -1791,12 +1808,14 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1808
  *  Returns elements from +self+; does not modify +self+.
  *
  *  When a single \Integer argument +index+ is given, returns the element at offset +index+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[0] # => :foo
  *    a[2] # => 2
  *    a # => [:foo, "bar", 2]
  *
  *  If +index+ is negative, counts relative to the end of +self+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[-1] # => 2
  *    a[-2] # => "bar"
@@ -1805,12 +1824,14 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1824
  *
  *  When two \Integer arguments +start+ and +length+ are given,
  *  returns a new \Array of size +length+ containing successive elements beginning at offset +start+:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[0, 2] # => [:foo, "bar"]
  *    a[1, 2] # => ["bar", 2]
  *
  *  If <tt>start + length</tt> is greater than <tt>self.length</tt>,
  *  returns all elements from offset +start+ to the end:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[0, 4] # => [:foo, "bar", 2]
  *    a[1, 3] # => ["bar", 2]
@@ -1824,6 +1845,7 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1845
  *  When a single \Range argument +range+ is given,
  *  treats <tt>range.min</tt> as +start+ above
  *  and <tt>range.size</tt> as +length+ above:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[0..1] # => [:foo, "bar"]
  *    a[1..2] # => ["bar", 2]
@@ -1831,18 +1853,21 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1853
  *  Special case: If <tt>range.start == a.size</tt>, returns a new empty \Array.
  *
  *  If <tt>range.end</tt> is negative, calculates the end index from the end:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[0..-1] # => [:foo, "bar", 2]
  *    a[0..-2] # => [:foo, "bar"]
  *    a[0..-3] # => [:foo]
  *
  *  If <tt>range.start</tt> is negative, calculates the start index from the end:
+ *
  *    a = [:foo, 'bar', 2]
  *    a[-1..2] # => [2]
  *    a[-2..2] # => ["bar", 2]
  *    a[-3..2] # => [:foo, "bar", 2]
  *
  *  If <tt>range.start</tt> is larger than the array size, returns +nil+.
+ *
  *    a = [:foo, 'bar', 2]
  *    a[4..1] # => nil
  *    a[4..0] # => nil
@@ -1851,11 +1876,13 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1876
  *  When a single Enumerator::ArithmeticSequence argument +aseq+ is given,
  *  returns an \Array of elements corresponding to the indexes produced by
  *  the sequence.
+ *
  *    a = ['--', 'data1', '--', 'data2', '--', 'data3']
  *    a[(1..).step(2)] # => ["data1", "data2", "data3"]
  *
  *  Unlike slicing with range, if the start or the end of the arithmetic sequence
  *  is larger than array size, throws RangeError.
+ *
  *    a = ['--', 'data1', '--', 'data2', '--', 'data3']
  *    a[(1..11).step(2)]
  *    # RangeError (((1..11).step(2)) out of range)
@@ -1864,6 +1891,7 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e); https://github.com/ruby/ruby/blob/trunk/array.c#L1891
  *
  *  If given a single argument, and its type is not one of the listed, tries to
  *  convert it to Integer, and raises if it is impossible:
+ *
  *    a = [:foo, 'bar', 2]
  *    # Raises TypeError (no implicit conversion of Symbol into Integer):
  *    a[:foo]
@@ -1922,6 +1950,7 @@ rb_ary_aref1(VALUE ary, VALUE arg) https://github.com/ruby/ruby/blob/trunk/array.c#L1950
  *    a = [:foo, 'bar', 2]
  *    a.at(0) # => :foo
  *    a.at(2) # => 2
+ *
  */
 
 VALUE
@@ -1938,6 +1967,7 @@ rb_ary_at(VALUE ary, VALUE pos) https://github.com/ruby/ruby/blob/trunk/array.c#L1967
  *  Returns elements from +self+; does not modify +self+.
  *
  *  When no argument is given, returns the first element:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.first # => :foo
  *    a # => [:foo, "bar", 2]
@@ -1946,14 +1976,17 @@ rb_ary_at(VALUE ary, VALUE pos) https://github.com/ruby/ruby/blob/trunk/array.c#L1976
  *
  *  When non-negative \Integer argument +n+ is given,
  *  returns the first +n+ elements in a new \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.first(2) # => [:foo, "bar"]
  *
  *  If <tt>n >= array.size</tt>, returns all elements:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.first(50) # => [:foo, "bar", 2]
  *
  *  If <tt>n == 0</tt> returns an new empty \Array:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.first(0) # []
  *
@@ -1979,6 +2012,7 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L2012
  *  Returns elements from +self+; +self+ is not modified.
  *
  *  When no argument is given, returns the last element:
+ *
  *    a = [:foo, 'bar', 2]
  *    a.last # => 2
  *    a # => [:foo, "bar", 2]
@@ -1987,14 +2021,17 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L2021
  *
  *  When non-negative \Innteger argument +n+ is given,
  * (... truncated)

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

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