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

17 commits

Author SHA1 Message Date
akr
461bd62fec * enumerator.c (ary2sv): add dup argument.
(enumerator_next): call ary2sv with dup=0.
  (enumerator_peek): call ary2sv with dup=1 to return duplicated array.
  (enumerator_peek_values_m): new function to return duplicated array.
  (Init_Enumerator): use enumerator_peek_values_m as
  Enumerator#peek_value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-21 15:51:35 +00:00
akr
0c0f754400 * enumerator.c (next_init): don't clear feedvalue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-19 17:32:56 +00:00
akr
3b4949ffa8 * enumerator.c: implement Enumerator#{next_values,peek_values,feed}
and StopIteration#result.  [ruby-dev:39109]
  (struct enumerator): replace no_next by stop_exc.
  new field feedvalue.
  (enumerator_mark): mark feedvalue and stop_exc.
  (enumerator_init): initialize feedvalue and stop_exc.
  (enumerator_init_copy): initialize feedvalue.
  (next_ii): send yield arguments as an array.  return feedvalue.
  (next_i): generate StopIteration exception here.  set result.
  (next_init): initialize feedvalue.
  (enumerator_next_values): new method Enumerator#next_values.
  (ary2sv): new function.
  (enumerator_peek_values): new method Enumerator#peek_values.
  (enumerator_feed): new method Enumerator#feed.
  (yielder_yield): return the yield value.
  (generator_each): return the iterator value.
  (stop_result): new method StopIteration#result.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-19 16:36:00 +00:00
akr
2772c80ce0 * enumerator.c (enumerator_peek): new method Enumerator#peek.
(enumerator_next): don't rewind at end.
  [ruby-dev:38932]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-18 12:02:53 +00:00
mame
3e11901f1c * enumerator.c (enumerator_with_index): receives one argument which
represents a start offset.  [ruby-dev:37921]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 14:42:01 +00:00
knu
0924bcf835 * test/ruby/test_enumerator.rb (TestEnumerator#test_with_object):
Add (back) the test for Enumerable#with_object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-26 10:26:45 +00:00
knu
cb32985d03 * enumerator.c (enumerator_initialize),
test/ruby/test_enumerator.rb: Add an ability to generate an
  enumerator from a block. [experimental] [ruby-dev:35903]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-26 05:42:12 +00:00
knu
d4b7cc796c * golf_prelude.rb, lib/set.rb (TC_Set#test_each),
test/readline/test_readline_history.rb (Readline#test_each__enumerator),
  test/ruby/test_array.rb (TestArray#test_collect),
  test/ruby/test_enumerator.rb (TestEnumerator#test_initialize):
  Enumerable::Enumerator is now called Enumerator.

* lib/rinda/tuplespace.rb (Rinda::TupleBag#initialize): Use
  enum_for instead of hardcoding Enumerable::Enumerator.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 08:03:30 +00:00
ko1
1bc6479a88 * test/ruby/test_enumerator.rb: fix to skip "with_memo" test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 02:49:28 +00:00
knu
a96cf7a7a5 * enumerator.c (enumerator_with_memo): New method: with_memo().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-03 12:43:45 +00:00
matz
4bf25bbe20 test/ruby/test_enumerator.rb: updated
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 14:41:07 +00:00
mame
7390164a64 * test/ruby/test_enumerator.rb: add tests to achieve over 90% test
coverage of enumerator.c.
* test/ruby/test_enum.rb: add for enum.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 13:59:13 +00:00
nobu
75feee0968 * set eol-style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-16 01:30:29 +00:00
ko1
977d66ec99 * cont.c: separate Continuation and Fiber from core.
* ext/continuation/*, ext/fiber/*: ditto.
* include/ruby/ruby.h: remove rb_cFiber.
* include/ruby/intern.h: add the rb_fiber_new() declaration.
* enumerator.c (next_init): fix to use rb_fiber_new().
* test/ruby/test_enumerator.rb: remove next? tests.
* test/ruby/test_continuation.rb: add a require 'continuation'.
* test/ruby/test_fiber.rb: add a require 'fiber'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 02:03:44 +00:00
ko1
3fffbe1e82 * test/ruby/test_enumerator.rb: fix last commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-20 19:09:03 +00:00
ko1
2d3724e058 * test_enumerator.rb (enum_test): fix to return sorted
array (for Hash test).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-20 19:00:27 +00:00
ko1
ad56f8c611 * enumerator.c (next_i): fix to return with Fiber#yield at
the end of each block.  [ruby-dev:31470]
* enumerator.c (enumerator_next_p): call init_next if not
  initialized.  [ruby-dev:31514]
* test/ruby/test_enumerator.rb: add tests for Enumerator.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-20 18:58:32 +00:00