summaryrefslogtreecommitdiff
path: root/struct.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 /struct.c
parent8092a810ff9a433e3f7d4edefc7744dfa81d8c70 (diff)
* 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 'struct.c')
-rw-r--r--struct.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index fe3885f7a6..83c63a8b47 100644
--- a/struct.c
+++ b/struct.c
@@ -442,10 +442,13 @@ rb_struct_new(VALUE klass, ...)
/*
* call-seq:
* struct.each {|obj| block } => struct
+ * struct.each => an_enumerator
*
* Calls <i>block</i> once for each instance variable, passing the
* value as a parameter.
*
+ * If no block is given, an enumerator is returned instead.
+ *
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
* joe.each {|x| puts(x) }
@@ -472,10 +475,13 @@ rb_struct_each(VALUE s)
/*
* call-seq:
* struct.each_pair {|sym, obj| block } => struct
+ * struct.each_pair => an_enumerator
*
* Calls <i>block</i> once for each instance variable, passing the name
* (as a symbol) and the value as parameters.
*
+ * If no block is given, an enumerator is returned instead.
+ *
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
* joe.each_pair {|name, value| puts("#{name} => #{value}") }
@@ -734,7 +740,7 @@ struct_entry(VALUE s, long n)
* struct.values_at(selector,... ) => an_array
*
* Returns an array containing the elements in
- * _self_ corresponding to the given selector(s). The selectors
+ * +self+ corresponding to the given selector(s). The selectors
* may be either integer indices or ranges.
* See also </code>.select<code>.
*
@@ -754,6 +760,7 @@ rb_struct_values_at(int argc, VALUE *argv, VALUE s)
/*
* call-seq:
* struct.select {|i| block } => array
+ * struct.select => an_enumerator
*
* Invokes the block passing in successive elements from
* <i>struct</i>, returning an array containing those elements