1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

5 commits

Author SHA1 Message Date
knu
cc58638faa * 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@16108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 12:02:59 +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