mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enumerator.c (Init_Enumerator): Rename Enumerable::Enumerator to
just Enumerator and redefine the former as an alias for backward compatibility. * lib/set.rb (TC_Set#test_each), test/ruby/test_enumerator.rb (TestEnumerator#test_initialize): Enumerable::Enumerator is now called Enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
20b0ce90d5
commit
4a8fd29e44
4 changed files with 23 additions and 12 deletions
19
enumerator.c
19
enumerator.c
|
@ -15,7 +15,7 @@
|
|||
#include "ruby.h"
|
||||
|
||||
/*
|
||||
* Document-class: Enumerable::Enumerator
|
||||
* Document-class: Enumerator
|
||||
*
|
||||
* A class which provides a method `each' to be used as an Enumerable
|
||||
* object.
|
||||
|
@ -66,7 +66,7 @@ enumerator_ptr(obj)
|
|||
* obj.to_enum(method = :each, *args)
|
||||
* obj.enum_for(method = :each, *args)
|
||||
*
|
||||
* Returns Enumerable::Enumerator.new(self, method, *args).
|
||||
* Returns Enumerator.new(self, method, *args).
|
||||
*
|
||||
* e.g.:
|
||||
*
|
||||
|
@ -258,11 +258,11 @@ enumerator_init(enum_obj, obj, meth, argc, argv)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* Enumerable::Enumerator.new(obj, method = :each, *args)
|
||||
* Enumerator.new(obj, method = :each, *args)
|
||||
*
|
||||
* Creates a new Enumerable::Enumerator object, which is to be
|
||||
* used as an Enumerable object using the given object's given
|
||||
* method with the given arguments.
|
||||
* Creates a new Enumerator object, which is to be used as an
|
||||
* Enumerable object using the given object's given method with the
|
||||
* given arguments.
|
||||
*
|
||||
* Use of this method is discouraged. Use Kernel#enum_for() instead.
|
||||
*/
|
||||
|
@ -430,9 +430,8 @@ Init_Enumerator()
|
|||
rb_define_method(rb_mEnumerable, "each_cons", enum_each_cons, 1);
|
||||
rb_define_method(rb_mEnumerable, "enum_cons", enum_each_cons, 1);
|
||||
|
||||
rb_cEnumerator = rb_define_class_under(rb_mEnumerable, "Enumerator", rb_cObject);
|
||||
rb_cEnumerator = rb_define_class("Enumerator", rb_cObject);
|
||||
rb_include_module(rb_cEnumerator, rb_mEnumerable);
|
||||
rb_define_global_const("Enumerator", rb_cEnumerator);
|
||||
|
||||
rb_define_alloc_func(rb_cEnumerator, enumerator_allocate);
|
||||
rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
|
||||
|
@ -447,5 +446,7 @@ Init_Enumerator()
|
|||
|
||||
sym_each = ID2SYM(rb_intern("each"));
|
||||
|
||||
rb_provide("enumerator.so"); /* for backward compatibility */
|
||||
/* backward compatibility */
|
||||
rb_provide("enumerator.so");
|
||||
rb_define_const(rb_mEnumerable, "Enumerator", rb_cEnumerator);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue