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

* array.c (rb_ary_slice_bang): Be consistent with Array#slice()

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
This commit is contained in:
knu 2008-05-24 20:07:54 +00:00
parent 258129588f
commit 065f538086
3 changed files with 26 additions and 3 deletions

View file

@ -422,6 +422,7 @@ Init_Enumerator()
rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
rb_define_method(rb_cEnumerator, "each_with_index", enumerator_with_index, 0);
rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, 0);
rb_define_method(rb_cEnumerator, "next", enumerator_next, 0);
rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);