diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-17 21:50:00 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-17 21:50:00 +0000 |
commit | 26134a6dc13f8cd6af6692ae53d440d7ea9deb13 (patch) | |
tree | cc4230483c7ba5d8ced17943f954fc9dbe72ea9f /enum.c | |
parent | 9c5fb33a694b87ccbfe08dee0f9e3da3bbbf3fff (diff) |
* array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]
* bignum.c: ditto
* class.c: ditto
* compar.c: ditto
* cont.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enum.c: ditto
* enumerator.c: ditto
* error.c: ditto
* eval.c: ditto
* file.c: ditto
* gc.c: ditto
* hash.c: ditto
* io.c: ditto
* load.c: ditto
* marshal.c: ditto
* math.c: ditto
* numeric.c: ditto
* object.c: ditto
* pack.c: ditto
* proc.c: ditto
* process.c: ditto
* random.c: ditto
* range.c: ditto
* re.c: ditto
* ruby.c: ditto
* signal.c: ditto
* sprintf.c: ditto
* string.c: ditto
* struct.c: ditto
* thread.c: ditto
* time.c: ditto
* transcode.c: ditto
* variable.c: ditto
* vm_eval.c: ditto
* vm_method.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 198 |
1 files changed, 99 insertions, 99 deletions
@@ -56,8 +56,8 @@ grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv) /* * call-seq: - * enum.grep(pattern) => array - * enum.grep(pattern) {| obj | block } => array + * enum.grep(pattern) -> array + * enum.grep(pattern) {| obj | block } -> array * * Returns an array of every element in <i>enum</i> for which * <code>Pattern === element</code>. If the optional <em>block</em> is @@ -121,9 +121,9 @@ count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv) /* * call-seq: - * enum.count => int - * enum.count(item) => int - * enum.count {| obj | block } => int + * enum.count -> int + * enum.count(item) -> int + * enum.count {| obj | block } -> int * * Returns the number of items in <i>enum</i>, where #size is called * if it responds to it, otherwise the items are counted through @@ -132,9 +132,9 @@ count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv) * given, counts the number of elements yielding a true value. * * ary = [1, 2, 4, 2] - * ary.count # => 4 - * ary.count(2) # => 2 - * ary.count{|x|x%2==0} # => 3 + * ary.count #=> 4 + * ary.count(2) #=> 2 + * ary.count{|x|x%2==0} #=> 3 * */ @@ -179,10 +179,10 @@ find_i(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.detect(ifnone = nil) {| obj | block } => obj or nil - * enum.find(ifnone = nil) {| obj | block } => obj or nil - * enum.detect(ifnone = nil) => an_enumerator - * enum.find(ifnone = nil) => an_enumerator + * enum.detect(ifnone = nil) {| obj | block } -> obj or nil + * enum.find(ifnone = nil) {| obj | block } -> obj or nil + * enum.detect(ifnone = nil) -> an_enumerator + * enum.find(ifnone = nil) -> an_enumerator * * Passes each entry in <i>enum</i> to <em>block</em>. Returns the * first for which <em>block</em> is not false. If no @@ -244,9 +244,9 @@ find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv) /* * call-seq: - * enum.find_index(value) => int or nil - * enum.find_index {| obj | block } => int or nil - * enum.find_index => an_enumerator + * enum.find_index(value) -> int or nil + * enum.find_index {| obj | block } -> int or nil + * enum.find_index -> an_enumerator * * Compares each entry in <i>enum</i> with <em>value</em> or passes * to <em>block</em>. Returns the index for the first for which the @@ -298,10 +298,10 @@ find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv) /* * call-seq: - * enum.find_all {| obj | block } => array - * enum.select {| obj | block } => array - * enum.find_all => an_enumerator - * enum.select => an_enumerator + * enum.find_all {| obj | block } -> array + * enum.select {| obj | block } -> array + * enum.find_all -> an_enumerator + * enum.select -> an_enumerator * * Returns an array containing all elements of <i>enum</i> for which * <em>block</em> is not <code>false</code> (see also @@ -340,8 +340,8 @@ reject_i(VALUE i, VALUE ary, int argc, VALUE *argv) /* * call-seq: - * enum.reject {| obj | block } => array - * enum.reject => an_enumerator + * enum.reject {| obj | block } -> array + * enum.reject -> an_enumerator * * Returns an array for all elements of <i>enum</i> for which * <em>block</em> is false (see also <code>Enumerable#find_all</code>). @@ -384,10 +384,10 @@ collect_all(VALUE i, VALUE ary, int argc, VALUE *argv) /* * call-seq: - * enum.collect {| obj | block } => array - * enum.map {| obj | block } => array - * enum.collect => an_enumerator - * enum.map => an_enumerator + * enum.collect {| obj | block } -> array + * enum.map {| obj | block } -> array + * enum.collect -> an_enumerator + * enum.map -> an_enumerator * * Returns a new array with the results of running <em>block</em> once * for every element in <i>enum</i>. @@ -431,10 +431,10 @@ flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv) /* * call-seq: - * enum.flat_map {| obj | block } => array - * enum.collect_concat {| obj | block } => array - * enum.flat_map => an_enumerator - * enum.collect_concat => an_enumerator + * enum.flat_map {| obj | block } -> array + * enum.collect_concat {| obj | block } -> array + * enum.flat_map -> an_enumerator + * enum.collect_concat -> an_enumerator * * Returns a new array with the concatenated results of running * <em>block</em> once for every element in <i>enum</i>. @@ -460,8 +460,8 @@ enum_flat_map(VALUE obj) /* * call-seq: - * enum.to_a => array - * enum.entries => array + * enum.to_a -> array + * enum.entries -> array * * Returns an array containing the items in <i>enum</i>. * @@ -513,15 +513,15 @@ inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv) /* * call-seq: - * enum.inject(initial, sym) => obj - * enum.inject(sym) => obj - * enum.inject(initial) {| memo, obj | block } => obj - * enum.inject {| memo, obj | block } => obj + * enum.inject(initial, sym) -> obj + * enum.inject(sym) -> obj + * enum.inject(initial) {| memo, obj | block } -> obj + * enum.inject {| memo, obj | block } -> obj * - * enum.reduce(initial, sym) => obj - * enum.reduce(sym) => obj - * enum.reduce(initial) {| memo, obj | block } => obj - * enum.reduce {| memo, obj | block } => obj + * enum.reduce(initial, sym) -> obj + * enum.reduce(sym) -> obj + * enum.reduce(initial) {| memo, obj | block } -> obj + * enum.reduce {| memo, obj | block } -> obj * * Combines all elements of <i>enum</i> by applying a binary * operation, specified by a block or a symbol that names a @@ -603,8 +603,8 @@ partition_i(VALUE i, VALUE *ary, int argc, VALUE *argv) /* * call-seq: - * enum.partition {| obj | block } => [ true_array, false_array ] - * enum.partition => an_enumerator + * enum.partition {| obj | block } -> [ true_array, false_array ] + * enum.partition -> an_enumerator * * Returns two arrays, the first containing the elements of * <i>enum</i> for which the block evaluates to true, the second @@ -652,8 +652,8 @@ group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv) /* * call-seq: - * enum.group_by {| obj | block } => a_hash - * enum.group_by => an_enumerator + * enum.group_by {| obj | block } -> a_hash + * enum.group_by -> an_enumerator * * Returns a hash, which keys are evaluated result from the * block, and values are arrays of elements in <i>enum</i> @@ -703,8 +703,8 @@ first_i(VALUE i, VALUE *params, int argc, VALUE *argv) /* * call-seq: - * enum.first -> obj or nil - * enum.first(n) -> an_array + * enum.first -> obj or nil + * enum.first(n) -> an_array * * Returns the first element, or the first +n+ elements, of the enumerable. * If the enumerable is empty, the first form returns <code>nil</code>, and the @@ -740,8 +740,8 @@ enum_first(int argc, VALUE *argv, VALUE obj) /* * call-seq: - * enum.sort => array - * enum.sort {| a, b | block } => array + * enum.sort -> array + * enum.sort {| a, b | block } -> array * * Returns an array containing the items in <i>enum</i> sorted, * either according to their own <code><=></code> method, or by using @@ -792,8 +792,8 @@ sort_by_cmp(const void *ap, const void *bp, void *data) /* * call-seq: - * enum.sort_by {| obj | block } => array - * enum.sort_by => an_enumerator + * enum.sort_by {| obj | block } -> array + * enum.sort_by -> an_enumerator * * Sorts <i>enum</i> using a set of keys generated by mapping the * values in <i>enum</i> through the given block. @@ -924,7 +924,7 @@ DEFINE_ENUMFUNCS(all) /* * call-seq: - * enum.all? [{|obj| block } ] => true or false + * enum.all? [{|obj| block } ] -> true or false * * Passes each element of the collection to the given block. The method * returns <code>true</code> if the block never returns @@ -959,7 +959,7 @@ DEFINE_ENUMFUNCS(any) /* * call-seq: - * enum.any? [{|obj| block } ] => true or false + * enum.any? [{|obj| block } ] -> true or false * * Passes each element of the collection to the given block. The method * returns <code>true</code> if the block ever returns a value other @@ -1000,7 +1000,7 @@ DEFINE_ENUMFUNCS(one) /* * call-seq: - * enum.one? [{|obj| block }] => true or false + * enum.one? [{|obj| block }] -> true or false * * Passes each element of the collection to the given block. The method * returns <code>true</code> if the block returns <code>true</code> @@ -1037,7 +1037,7 @@ DEFINE_ENUMFUNCS(none) /* * call-seq: - * enum.none? [{|obj| block }] => true or false + * enum.none? [{|obj| block }] -> true or false * * Passes each element of the collection to the given block. The method * returns <code>true</code> if the block never returns <code>true</code> @@ -1100,8 +1100,8 @@ min_ii(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.min => obj - * enum.min {| a,b | block } => obj + * enum.min -> obj + * enum.min {| a,b | block } -> obj * * Returns the object in <i>enum</i> with the minimum value. The * first form assumes all objects implement <code>Comparable</code>; @@ -1167,8 +1167,8 @@ max_ii(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.max => obj - * enum.max {|a,b| block } => obj + * enum.max -> obj + * enum.max {|a,b| block } -> obj * * Returns the object in _enum_ with the maximum value. The * first form assumes all objects implement <code>Comparable</code>; @@ -1306,8 +1306,8 @@ minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv) /* * call-seq: - * enum.minmax => [min,max] - * enum.minmax {|a,b| block } => [min,max] + * enum.minmax -> [min,max] + * enum.minmax {|a,b| block } -> [min,max] * * Returns two elements array which contains the minimum and the * maximum value in the enumerable. The first form assumes all @@ -1365,8 +1365,8 @@ min_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.min_by {|obj| block } => obj - * enum.min_by => an_enumerator + * enum.min_by {|obj| block } -> obj + * enum.min_by -> an_enumerator * * Returns the object in <i>enum</i> that gives the minimum * value from the given block. @@ -1411,8 +1411,8 @@ max_by_i(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.max_by {|obj| block } => obj - * enum.max_by => an_enumerator + * enum.max_by {|obj| block } -> obj + * enum.max_by -> an_enumerator * * Returns the object in <i>enum</i> that gives the maximum * value from the given block. @@ -1508,8 +1508,8 @@ minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv) /* * call-seq: - * enum.minmax_by {|obj| block } => [min, max] - * enum.minmax_by => an_enumerator + * enum.minmax_by {|obj| block } -> [min, max] + * enum.minmax_by -> an_enumerator * * Returns two elements array array containing the objects in * <i>enum</i> that gives the minimum and maximum values respectively @@ -1552,8 +1552,8 @@ member_i(VALUE iter, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.include?(obj) => true or false - * enum.member?(obj) => true or false + * enum.include?(obj) -> true or false + * enum.member?(obj) -> true or false * * Returns <code>true</code> if any member of <i>enum</i> equals * <i>obj</i>. Equality is tested using <code>==</code>. @@ -1584,8 +1584,8 @@ each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv) /* * call-seq: - * enum.each_with_index(*args) {|obj, i| block } -> enum - * enum.each_with_index(*args) -> an_enumerator + * enum.each_with_index(*args) {|obj, i| block } -> enum + * enum.each_with_index(*args) -> an_enumerator * * Calls <em>block</em> with two arguments, the item and its index, * for each item in <i>enum</i>. Given arguments are passed through @@ -1616,8 +1616,8 @@ enum_each_with_index(int argc, VALUE *argv, VALUE obj) /* * call-seq: - * enum.reverse_each(*args) {|item| block } -> enum - * enum.reverse_each(*args) -> an_enumerator + * enum.reverse_each(*args) {|item| block } -> enum + * enum.reverse_each(*args) -> an_enumerator * * Builds a temporary array and traverses that array in reverse order. * @@ -1653,8 +1653,8 @@ each_val_i(VALUE i, VALUE p, int argc, VALUE *argv) /* * call-seq: - * enum.each_entry {|obj| block} => enum - * enum.each_entry => an_enumerator + * enum.each_entry {|obj| block} -> enum + * enum.each_entry -> an_enumerator * * Calls <i>block</i> once for each element in +self+, passing that * element as a parameter, converting multiple values from yield to an @@ -1704,8 +1704,8 @@ each_slice_i(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.each_slice(n) {...} -> nil - * enum.each_slice(n) -> an_enumerator + * enum.each_slice(n) {...} -> nil + * enum.each_slice(n) -> an_enumerator * * Iterates the given block for each slice of <n> elements. If no * block is given, returns an enumerator. @@ -1758,8 +1758,8 @@ each_cons_i(VALUE i, VALUE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.each_cons(n) {...} -> nil - * enum.each_cons(n) -> an_enumerator + * enum.each_cons(n) {...} -> nil + * enum.each_cons(n) -> an_enumerator * * Iterates the given block for each array of consecutive <n> * elements. If no block is given, returns an enumerator. @@ -1802,8 +1802,8 @@ each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv) /* * call-seq: - * enum.each_with_object(obj) {|(*args), memo_obj| ... } -> obj - * enum.each_with_object(obj) -> an_enumerator + * enum.each_with_object(obj) {|(*args), memo_obj| ... } -> obj + * enum.each_with_object(obj) -> an_enumerator * * Iterates the given block for each element with an arbitrary * object given, and returns the initially given object. @@ -1812,7 +1812,7 @@ each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv) * * e.g.: * evens = (1..10).each_with_object([]) {|i, a| a << i*2 } - * # => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] + * #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] * */ static VALUE @@ -1904,8 +1904,8 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv) /* * call-seq: - * enum.zip(arg, ...) => an_enumerator - * enum.zip(arg, ...) {|arr| block } => nil + * enum.zip(arg, ...) -> an_enumerator + * enum.zip(arg, ...) {|arr| block } -> nil * * Takes one element from <i>enum</i> and merges corresponding * elements from each <i>args</i>. This generates a sequence of @@ -1970,12 +1970,12 @@ take_i(VALUE i, VALUE *arg, int argc, VALUE *argv) /* * call-seq: - * enum.take(n) => array + * enum.take(n) -> array * * Returns first n elements from <i>enum</i>. * * a = [1, 2, 3, 4, 5, 0] - * a.take(3) # => [1, 2, 3] + * a.take(3) #=> [1, 2, 3] * */ @@ -2007,8 +2007,8 @@ take_while_i(VALUE i, VALUE *ary, int argc, VALUE *argv) /* * call-seq: - * enum.take_while {|arr| block } => array - * enum.take_while => an_enumerator + * enum.take_while {|arr| block } -> array + * enum.take_while -> an_enumerator * * Passes elements to the block until the block returns +nil+ or +false+, * then stops iterating and returns an array of all prior elements. @@ -2016,7 +2016,7 @@ take_while_i(VALUE i, VALUE *ary, int argc, VALUE *argv) * If no block is given, an enumerator is returned instead. * * a = [1, 2, 3, 4, 5, 0] - * a.take_while {|i| i < 3 } # => [1, 2] + * a.take_while {|i| i < 3 } #=> [1, 2] * */ @@ -2045,13 +2045,13 @@ drop_i(VALUE i, VALUE *arg, int argc, VALUE *argv) /* * call-seq: - * enum.drop(n) => array + * enum.drop(n) -> array * * Drops first n elements from <i>enum</i>, and returns rest elements * in an array. * * a = [1, 2, 3, 4, 5, 0] - * a.drop(3) # => [4, 5, 0] + * a.drop(3) #=> [4, 5, 0] * */ @@ -2088,8 +2088,8 @@ drop_while_i(VALUE i, VALUE *args, int argc, VALUE *argv) /* * call-seq: - * enum.drop_while {|arr| block } => array - * enum.drop_while => an_enumerator + * enum.drop_while {|arr| block } -> array + * enum.drop_while -> an_enumerator * * Drops elements up to, but not including, the first element for * which the block returns +nil+ or +false+ and returns an array @@ -2098,7 +2098,7 @@ drop_while_i(VALUE i, VALUE *args, int argc, VALUE *argv) * If no block is given, an enumerator is returned instead. * * a = [1, 2, 3, 4, 5, 0] - * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0] + * a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0] * */ @@ -2126,8 +2126,8 @@ cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv) /* * call-seq: - * enum.cycle(n=nil) {|obj| block } -> nil - * enum.cycle(n=nil) -> an_enumerator + * enum.cycle(n=nil) {|obj| block } -> nil + * enum.cycle(n=nil) -> an_enumerator * * Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_ * times or forever if none or +nil+ is given. If a non-positive @@ -2257,8 +2257,8 @@ chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv) /* * call-seq: - * enum.chunk {|elt| ... } => an_enumerator - * enum.chunk(initial_state) {|elt, state| ... } => an_enumerator + * enum.chunk {|elt| ... } -> an_enumerator + * enum.chunk(initial_state) {|elt, state| ... } -> an_enumerator * * Creates an enumerator for each chunked elements. * The consecutive elements which have same block value are chunked. @@ -2432,9 +2432,9 @@ slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv) /* * call-seq: - * enum.slice_before(pattern) => an_enumerator - * enum.slice_before {|elt| bool } => an_enumerator - * enum.slice_before(initial_state) {|elt, state| bool } => an_enumerator + * enum.slice_before(pattern) -> an_enumerator + * enum.slice_before {|elt| bool } -> an_enumerator + * enum.slice_before(initial_state) {|elt, state| bool } -> an_enumerator * * Creates an enumerator for each chunked elements. * The beginnings of chunks are defined by _pattern_ and the block. |