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@16768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and String#slice!(). Just return nil when a negative length or
out of boundary index is given instead of raising an exception
via internal functions.
(rb_ary_slice_bang): should not use rb_ary_subseq() which shares
internal pointer. splice modifies the receiver right after
subseq. [ruby-dev:34005]
(rb_ary_slice_bang): should adjust length before making
sub-array.
* enumerator.c (Init_Enumerator): Override
Enumerable::Enumerator#each_with_index with #with_index.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(enumerator_initialize): Discourage the use.
(enum_each_slice, enum_each_cons, enumerator_each)
(enumerator_with_index): Add a note about a call without a block.
* NEWS: Intentionally omit enum_slice and enum_cons, which are
removed in 1.9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
feature (passing a block to the constructor) that's broken.
This is not what I intended.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c (enumerator_each): need not to call rb_to_id().
* enumerator.c (enumerator_with_index): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
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
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