aboutsummaryrefslogtreecommitdiffstats
path: root/range.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-13 05:49:55 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-13 05:49:55 +0000
commit4afa9ed0418555ba20158e55cf3bf9ec563fbecb (patch)
tree1dec7ee61e0d81c64aa0d32a5b7a7c0e8481282a /range.c
parent8092a810ff9a433e3f7d4edefc7744dfa81d8c70 (diff)
downloadruby-4afa9ed0418555ba20158e55cf3bf9ec563fbecb.tar.gz
* array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators - array methods and argument naming (array -> ary, an_array -> new_ary) - minor improvements, typo fixed and styling issues Other documentation errors fixed: - return value was self instead of a new array (or vice-versa) for Array#{pop,shift,permutation,repeated_permutation,keep_if} - Array#rindex was missing the form with a block. * dir.c: ditto. * enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify that #each will be finish before any element is yielded. * error.c: ditto. * gc.c: ditto. * hash.c: ditto. * io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948] * numeric.c: ditto. * range.c: ditto. * string.c: ditto. * struct.c: ditto. * vm_eval.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/range.c b/range.c
index 60ad3939eb..ca9052e621 100644
--- a/range.c
+++ b/range.c
@@ -319,6 +319,7 @@ discrete_object_p(VALUE obj)
/*
* call-seq:
* rng.step(n=1) {| obj | block } => rng
+ * rng.step(n=1) => an_enumerator
*
* Iterates over <i>rng</i>, passing each <i>n</i>th element to the block. If
* the range contains numbers, <i>n</i> is added for each iteration. Otherwise
@@ -326,6 +327,8 @@ discrete_object_p(VALUE obj)
* elements. The following code uses class <code>Xs</code>, which is defined
* in the class-level documentation.
*
+ * If no block is given, an enumerator is returned instead.
+ *
* range = Xs.new(1)..Xs.new(10)
* range.step(2) {|x| puts x}
* range.step(3) {|x| puts x}
@@ -453,12 +456,15 @@ sym_each_i(VALUE v, void *arg)
/*
* call-seq:
* rng.each {| i | block } => rng
+ * rng.each => an_enumerator
*
* Iterates over the elements <i>rng</i>, passing each in turn to the
* block. You can only iterate if the start object of the range
* supports the +succ+ method (which means that you can't iterate over
* ranges of +Float+ objects).
*
+ * If no block is given, an enumerator is returned instead.
+ *
* (10..15).each do |n|
* print n, ' '
* end