aboutsummaryrefslogtreecommitdiffstats
path: root/enum.c
Commit message (Collapse)AuthorAgeFilesLines
...
* fix doc.akr2008-03-091-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_one, enum_take_while, enum_drop_while): fix documents.mame2008-01-241-4/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Updating the documentation of Enumrable#zip to reflectjeg22008-01-081-6/+7
| | | | | | | the recent changes Matz made to the method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): honor length of the receiver, not thematz2008-01-081-14/+35
| | | | | | | | | | | | | shortest length. [ruby-core:14738] * enum.c (enum_zip): returns array not enumerator for no block form. [ruby-core:14738] * enumerator.c (next_ii): do not ignore multiple values yielded. * array.c (rb_ary_zip): faster version without creating generators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (collect_all): should pack all values. [ruby-core:14410]matz2007-12-251-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_yield): when multiple values yielded from #eachmatz2007-12-251-43/+57
| | | | | | | | | pack them into an array. [ruby-dev:32708] * enum.c: all method but all?, any?, one? and none? passed packed multiple values to the block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_inject): updated documentation. a patch from Keitamatz2007-12-231-3/+3
| | | | | | Yamaguchi <keita.yamaguchi@gmail.com> in [ruby-dev:32686]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_count): suppress warning.akr2007-12-081-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_count): precise argument number check.matz2007-11-301-2/+7
| | | | | | * enum.c (enum_count): return Enumerator if no block given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_take_while): returns Enumerator if no block given.matz2007-11-301-0/+2
| | | | | | * enum.c (enum_drop_while): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (each_with_index_i): use rb_yield_values() formatz2007-11-091-1/+1
| | | | | | | compatibility with Enumerator#with_index(). a patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32195] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_with_index): make different arrays at eachnobu2007-11-071-13/+6
| | | | | | | iteration. [ruby-dev:32181] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (take_while_i, drop_while_i) add RTEST to handle nil returndavidflanagan2007-11-011-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_drop): fix typo.usa2007-10-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_take_while): separate with-block form.matz2007-10-301-89/+73
| | | | | | | | * enum.c (drop_while_i): ditto. * enum.c (enum_butfirst): abandon butfirst method. reverted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_butfirst): add a new method to iterates overmatz2007-10-301-0/+38
| | | | | | | | | elements but first n. RDoc need to be updated. * enumerator.c (Init_Enumerator): remove unnecessary symbol initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): hide temporary array from ObjectSpace.matz2007-10-221-4/+7
| | | | | | [ruby-core:12762] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_find_index): update RDoc. a patch from David Flanaganmatz2007-10-181-14/+18
| | | | | | | | | | | | | <david AT davidflanagan.com> in [ruby-core:12710]. * enum.c (enum_take, enum_drop): ditto. * enum.c (enum_cycle): should not cause infinite loop for empty arrays. [ruby-core:12710] <david AT davidflanagan.com> in [ruby-core:12710]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c (range_first): takes first n element if argument ismatz2007-10-181-1/+1
| | | | | | | | | | | given. [ruby-core:12697] * range.c (range_last): returns last n elements if argument is given. * array.c (rb_ary_subseq, rb_ary_last): export. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_inject): RDoc update. a patch from David Flanaganmatz2007-10-151-55/+38
| | | | | | <david AT davidflanagan.com> in [ruby-core:12679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): typo fixed. a patch from Kazuhiromatz2007-08-081-1/+1
| | | | | | NISHIYAMA <zn AT mbf.nifty.com>. [ruby-dev:31362] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next_p): should check correctly even whenmatz2007-08-081-1/+1
| | | | | | | | | | | | | | | | | e.next has not been called before. * enumerator.c (enumerator_next): raise StopIteration (name taken from Python) instead of IndexError. * enum.c (enum_zip): catch StopIteration exception. * enumerator.c (enumerator_with_index): return Enumerator if no block is given. * test/ruby/test_iterator.rb (TestIterator::test_enumerator): add test for enumerators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): zip no longer converts arguments intomatz2007-08-061-26/+30
| | | | | | arrays, uses enumerators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): new method to cycle enumerable forever.matz2007-08-061-0/+39
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]nobu2007-07-141-1/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_minmax): fix SEGV by [].minmax.akr2007-06-231-2/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_minmax): new method to get the minimum and maximummatz2007-06-231-2/+139
| | | | | | | | values from the enumerable at once. * enum.c (enum_minmax_by): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (each_with_index_i): should work well with continuation.matz2007-05-311-2/+2
| | | | | | | a patch from sheepman <sheepman AT sheepman.sakura.ne.jp>. [ruby-dev:30846] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_inject): minor improvement. [ruby-dev:30792]nobu2007-05-181-51/+34
| | | | | | | | | | | * enum.c (one_i): no needs to iterate once the result became false. * enum.c (enum_one): fix for an example. * enum.c (one_iter_i, none_iter_i): DRY.; git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_inject): it is now can work without block. youmatz2007-05-181-6/+73
| | | | | | | | have to specify two argument method name as the first argument. * enum.c (Init_Enumerable): reduce is new alias to inject. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_with_index): each_with_index to forwardmatz2007-04-161-4/+4
| | | | | | arguments to each. [ruby-core:10921] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (take_i): small cosmetic / documentation patch frommatz2007-02-271-6/+2
| | | | | | Tadashi Saito <shiba AT mail2.accsnet.ne.jp>. [ruby-dev:30446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_take): new method. [ruby-dev:30407]matz2007-02-271-0/+119
| | | | | | * enum.c (enum_drop): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_with_index): reuse array for yield parameters.matz2006-12-291-15/+42
| | | | | | * enum.c (enum_min, enum_max): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_inject): reuse array for yield parameters.matz2006-12-291-10/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): add RETURN_ENUMERATOR() to zip method.matz2006-10-251-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: revert last changesmatz2006-09-041-21/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/cgi.rb (CGI::out): specify -x option for nkf.matz2006-09-041-0/+21
| | | | | | | | * lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using NKF. it is too Japanese centric. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby.h (struct RArray): embed small arrays.matz2006-09-021-8/+8
| | | | | | | | | | (RARRAY_LEN): defined for accessing array members. (RARRAY_PTR): ditto. * array.c: use RARRAY_LEN and RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Documentation typo.drbrain2006-06-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_find_index): a new method Enumerable#find_index.matz2006-02-051-0/+40
| | | | | | | [ruby-talk:178495] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c: unify ruby_class (for method definition) and ruby_cbasematz2006-02-031-28/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (for constant reference). * eval.c (rb_call0): use TMP_ALLOC() instead of allocating a temporary array object. * eval.c (eval): need not to protect $SAFE value. [ruby-core:07177] * error.c (Init_Exception): change NameError to direct subclass of Exception so that default rescue do not handle it silently. * struct.c (rb_struct_select): update RDoc description. [ruby-core:7254] * numeric.c (int_upto): return an enumerator if no block is attached to the method. * numeric.c (int_downto): ditto. * numeric.c (int_dotimes): ditto. * enum.c (enum_first): new method Enumerable#first to take first n element from an enumerable. * enum.c (enum_group_by): new method Enumerable#group_by that groups enumerable values according to their block values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_define_method): should save safe_level in thematz2005-12-291-6/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | proc object. [ruby-dev:28146] * test/drb/drbtest.rb (DRbService::self.ext_service): increase timeout limit. a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>. [ruby-dev:28132] * eval.c (ev_const_get): fixed a bug in constant reference during instance_eval. [yarv-dev:707] * eval.c (ev_const_defined): ditto. * lib/yaml.rb (YAML::add_domain_type): typo fixed. a patch from Joel VanderWerf <vjoel at path.berkeley.edu>. [ruby-talk:165285] [ruby-core:6995] * ext/digest/sha2/sha2.c (ULL): support AIX C. a patch from Kailden <kailden at gmail.com>. [ruby-core:06984] * ext/syck/rubyext.c (rb_syck_compile): avoid potential memory leak. * ext/syck/rubyext.c (syck_set_ivars): avoid potential memory leak by explicit symbol allocation. * lib/delegate.rb (Delegator::method_missing): should delegate block as well. * lib/cgi.rb (CGI::QueryExtension::MorphingBody): fix criteria to use Tempfile. A fix from Zev Blut <rubyzbibd at ubit.com>. [ruby-core:06076] * string.c: remove global functions work on $_. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/digest/digest.c (rb_digest_base_s_digest): add volatile tomatz2005-12-121-1/+1
| | | | | | | | | | | protect temporary context object. [ruby-dev:27979] * ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should be called before actual variable initialization. [ruby-dev:27986] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, enum.c, eval.c, util.c: safer function pointer usage.nobu2005-10-111-4/+4
| | | | | | | | | | fixed: [ruby-core:06143] * util.h (qsort): removed the definition incompatible to ANSI. fixed: [ruby-core:06147] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e