Commit graph

12 commits

Author SHA1 Message Date
knu
c5d1fd68f7 * enumerator.c (enumerator_init_copy): Take care of
initialize_copy as well as initialize.

* test/ruby/test_enumerator.rb: Pull in the test suite for
  enumerator from trunk.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-03 11:06:38 +00:00
knu
1434fc3fa8 * enumerator.c (enumerator_allocate, enumerator_ptr): Properly
detect if the object is initialized and raise error when
  appropriate.
  (enumerator_initialize): Fix a typo in rdoc. [ruby-core:17052]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-03 04:03:15 +00:00
knu
a412a7e00d Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 20:21:59 +00:00
knu
072673ee41 Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 17:49:34 +00:00
knu
8480bcc8d5 Merge -r16241:16456 from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-18 15:02:36 +00:00
knu
a47dfe2763 Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 17:29:39 +00:00
knu
7f6df101ca Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-21 09:43:44 +00:00
knu
1684c86c33 * enumerator.c: Resolve the method every time an enumeration
method is run, not once when the enumerator is initialized as it
  was before, so that method_missing() and method (re)definition
  afterwards are both in effect; pointed out in: [ruby-core:16441]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 12:04:37 +00:00
knu
4c4fad2749 * ruby.h (rb_block_call_func): Fix prototype.
* enumerator.c (enumerator_iter_i, enumerator_each_i): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 07:43:40 +00:00
usa
4f56ca8218 * enumerator.c (enumerator_mark, enumerator_iter_i, enumerator_each_i,
enumerator_allocate): add prototype.

	* enumerator.c (enumerator_each_i): declare unused two arguments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 05:18:02 +00:00
knu
badb865567 * enumerator.c (rb_eStopIteration), eval.c (rb_f_loop), ruby.h:
Add a new exception class StopIteration, which breaks Kernel#loop
  iteration when raised; backported from 1.9.

* enumerator.c (enumerator_next, enumerator_rewind): Implement
  #next and #rewind using the "generator" library.

* lib/generator.rb: Implement Enumerable::Enumerator#next and
  #rewind.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10 10:52:50 +00:00
knu
fd8c8d09f4 * enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,
ext/enumerator, common.mk (OBJS, enumerator.$(OBJEXT)): Make the
  enumerator module built-in,

* enumerator.c: New method: Enumerable::Enumerator#with_index.

* enum.c (enum_each_with_index): Enumerable#each_with_index now
  returns an enumerator instead of raising an exception if no
  block is given.  Enumerable#enum_with_index, formerly defined in
  the enumerator module, is kept as an alias to each_with_index
  for backward compatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09 11:13:04 +00:00