mrblib/array.rb: add call-seq to each method description. [ci skip]
# 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 <code>true</code> 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 <i>other_ary</i>.
# 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
