aboutsummaryrefslogtreecommitdiffstats
path: root/enumerator.c
Commit message (Collapse)AuthorAgeFilesLines
* Update doc.akr2013-05-211-0/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: use VALUEnobu2013-05-181-16/+13
| | | | | | | * enumerator.c (inspect_enumerator): use VALUE instead of mere char* by using rb_sprintf() and rb_id2str(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: append_methodnobu2013-05-181-15/+20
| | | | | | * enumerator.c (append_method): extract from inspect_enumerator(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: fix stylenobu2013-05-181-1/+2
| | | | | | * enumerator.c (enumerator_initialize): no cuddle up else. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko12013-05-131-8/+8
| | | | | | | | instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Document synonymous methods, by windwiny [GH-277]zzak2013-04-121-0/+3
| | | | | | | | | | | | | | | * bignum.c: ditto * complex.c: ditto * dir.c: ditto * encoding.c: ditto * enumerator.c: ditto * numeric.c: ditto * proc.c: ditto * re.c: ditto * string.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_index): try to convert given offset tonaruse2013-03-111-0/+2
| | | | | | integer. fix bug introduced in r39594. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use INT2FIX(0) instead of INT2NUM(0).kazu2013-03-051-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_index): Restore handling of a nil memodrbrain2013-03-051-0/+2
| | | | | | | from r39594. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: allow Bignum for with_indexnobu2013-03-051-5/+2
| | | | | | | | | * enumerator.c (enumerator_with_index_i): allow Bignum as offset, to get rid of conversion exception and integer overflow. [ruby-dev:47131] [Bug #8010] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: rdoc fixmarcandre2013-02-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: suppress warningsnobu2013-02-201-5/+5
| | | | | | | | * enumerator.c (lazy_zip_arrays_func, lazy_zip_func, lazy_take_func), (lazy_drop_func, lazy_drop_while_func): suppress uninitialized instance vriable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Remove rdoc that is obsolete because of lazymarcandre2013-02-051-57/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Use to_enum for Enumerable methods returning Enumerators.marcandre2013-02-051-7/+11
| | | | | | | | | | | | | | This makes Lazy#cycle no longer needed, so it was removed. Make Enumerator#chunk and slice_before return lazy Enumerators. [Bug #7715] * internal.h: Remove ref to rb_enum_cycle_size; no longer needed * enum.c: Make enum_cycle_size static. * test/ruby/test_lazy_enumerator.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Finalize and document Lazy.new. [Bug #7248]marcandre2013-02-051-84/+112
| | | | | | | | Add Lazy#to_enum and simplify Lazy#size. * test/ruby/test_lazy_enumerator.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix and improve rdoc for to_enummarcandre2013-02-051-14/+36
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_zip): raise error for bad argumentsmarcandre2013-01-241-0/+6
| | | | | | [Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Optimize Lazy#zip when passed only arraysmarcandre2013-01-241-3/+35
| | | | | | [Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#zipmarcandre2013-01-241-9/+15
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#dropmarcandre2013-01-241-7/+8
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#drop_whilemarcandre2013-01-241-9/+5
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#takemarcandre2013-01-241-7/+10
| | | | | | | | [bug #7696] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_flat_map_func): flat_map should call each onlyshugo2013-01-141-15/+36
| | | | | | | | | | | when the value of a block returns a forcable object. [ruby-core:51401] [Bug #7690] * enumerator.c (lazy_flat_map): add documentation. * test/ruby/test_lazy_enumerator.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692]marcandre2013-01-141-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix size for Enumerator::Lazy#flat_mapmarcandre2013-01-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix rdoc typo (thanks to Yutaka HARA)marcandre2013-01-131-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use RB_TYPE_Pnobu2012-12-291-1/+1
| | | | | | | | | * enumerator.c (enumerator_initialize), eval.c (rb_using_refinement), (add_activated_refinement), numeric.c (num_interval_step_size), parse.y (arg, match_op_gen, cond0), range.c (range_bsearch), vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust style.nobu2012-12-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h: Restore rb_enumeratorize as it was before r37497marcandre2012-11-071-2/+11
| | | | | | | | and introduce rb_enumeratorize_with_size instead. [#7302] * enumerator.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: prefixnobu2012-11-061-1/+1
| | | | | | | * enum.c (rb_enum_cycle_size): prefix with rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust stylenobu2012-11-061-3/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.cycle.sizemarcandre2012-11-061-1/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Add support for lazy.drop.sizemarcandre2012-11-061-1/+14
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.take.sizemarcandre2012-11-061-1/+10
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.{map|flat_map|...}.sizemarcandre2012-11-061-12/+14
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.sizemarcandre2012-11-061-2/+21
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support #size for enumerators created from enumeratorsmarcandre2012-11-061-2/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (obj_to_enum): Have #to_enum accept a blockmarcandre2012-11-061-2/+11
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator: New method #size; constructor accepts sizemarcandre2012-11-061-11/+60
| | | | | | | | | [Feature #6636] * include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of sized enumerators git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_initialize): Warn when using deprecated formmarcandre2012-11-061-0/+1
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* obj_init_copynobu2012-06-051-0/+3
| | | | | | * object.c (rb_obj_init_copy): should check if trusted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use RB_TYPE_P() instead of comparison of TYPE()nobu2012-05-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_take_func, lazy_take): multiple calls ofnagachika2012-05-131-1/+2
| | | | | | | | | | force/to_a method to Enumerator::Lazy#take should return same results. [ruby-dev:45634] [Bug #6428] * test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* initialize IDs in advance.nobu2012-04-031-9/+12
| | | | | | * enumerator.c (Init_Enumerator): initialize IDs in advance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): suppress uninitializednobu2012-04-031-3/+3
| | | | | | | | instance variable warnings. [ruby-dev:45449][Bug #6214] patched by no6v (Nobuhiro IMAI). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): show method arguments ofshugo2012-03-261-36/+68
| | | | | | lazy enumerators correctly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator (lazy_initialize): set the instance variable "receiver"shugo2012-03-241-22/+8
| | | | | | | | | to include the receiver to the return value of inspect on a lazy enumerator directly created by Enumerator::Lazy.new. * enumerator (RETURN_LAZY): don't set the instance variable "receiver". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator (enumerator_inspect): include the original receiver andshugo2012-03-241-25/+64
| | | | | | | | | | | method name of Enumerator::Lazy in the result of inspect. [ruby-core:43345] [Bug #6159] * enumerator (InitVM_Enumerator): don't use rb_define_alias for some methods such as collect in order to make rb_frame_this_func() return the correct method names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_flat_map_func): convert the block value toshugo2012-03-191-1/+31
| | | | | | | Array if it doesn't respond to each. [ruby-core:43334] [Bug #6155] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerable_lazy): add an example of take and firstshugo2012-03-191-2/+4
| | | | | | | | to the documentation. [ruby-core:43344] [Bug #6158] add the description of the behavior when a block is given to zip or cycle. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e