From 4afa9ed0418555ba20158e55cf3bf9ec563fbecb Mon Sep 17 00:00:00 2001 From: marcandre Date: Thu, 13 May 2010 05:49:55 +0000 Subject: * 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 --- struct.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'struct.c') 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 block 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 block 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 .select. * @@ -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 * struct, returning an array containing those elements -- cgit v1.2.3