From 01392e2719b44e23c20d12df47c17648be5c3f8a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 22 Jun 2022 19:02:19 +0900 Subject: [PATCH] mrblib/array.rb: add call-seq to each method description. [ci skip] --- mrblib/array.rb | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/mrblib/array.rb b/mrblib/array.rb index cef944f8a..657a7a5e4 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -5,6 +5,10 @@ # ISO 15.2.12 class Array ## + # call-seq: + # array.each {|element| ... } -> self + # array.each -> Enumerator + # # Calls the given block for each element of +self+ # and pass the respective element. # @@ -21,6 +25,10 @@ class Array end ## + # call-seq: + # array.each_index {|index| ... } -> self + # array.each_index -> Enumerator + # # Calls the given block for each element of +self+ # and pass the index of the respective element. # @@ -37,6 +45,10 @@ class Array end ## + # call-seq: + # array.collect! {|element| ... } -> self + # array.collect! -> new_enumerator + # # Calls the given block for each element of +self+ # and pass the respective element. Each element will # be replaced by the resulting values. @@ -55,6 +67,10 @@ class Array end ## + # call-seq: + # array.map! {|element| ... } -> self + # array.map! -> new_enumerator + # # Alias for collect! # # ISO 15.2.12.5.20 @@ -110,6 +126,9 @@ class Array alias to_s inspect ## + # call-seq: + # array == other -> true or false + # # Equality---Two arrays are equal if they contain the same number # of elements and if each element is equal to (according to # Object.==) the corresponding element in the other array. @@ -129,6 +148,9 @@ class Array end ## + # call-seq: + # array.eql? other_array -> true or false + # # Returns true if +self+ and _other_ are the same object, # or are both arrays with the same content. # @@ -147,6 +169,9 @@ class Array end ## + # call-seq: + # array <=> other_array -> -1, 0, or 1 + # # Comparison---Returns an integer (-1, 0, or +1) # if this array is less than, equal to, or greater than other_ary. # Each object in each array is compared (using <=>). If any value isn't @@ -187,6 +212,10 @@ class Array end ## + # call-seq: + # array.delete(obj) -> deleted_object + # array.delete(obj) {|nosuch| ... } -> deleted_object or block_return + # # Delete element with index +key+ def delete(key, &block) while i = self.index(key) @@ -198,6 +227,10 @@ class Array end ## + # call-seq: + # array.sort! -> self + # array.sort! {|a, b| ... } -> self + # # Sort all elements and replace +self+ with these # elements. def sort!(&block) @@ -265,10 +298,21 @@ class Array self end + ## + # call-seq: + # array.sort -> new_array + # array.sort {|a, b| ... } -> new_array + # + # Returns a new Array whose elements are those from +self+, sorted. def sort(&block) self.dup.sort!(&block) end + ## + # call-seq: + # array.to_a -> self + # + # Returns self, no need to convert. def to_a self end