akr
73fc3b5a34
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 14:00:49 +00:00
mame
fec209551a
* enum.c (min_ii, max_ii, minmax_ii): remove wrong optimization that
...
reuses array for yield parameter, which caused unexpected behavior.
[ruby-core:25989]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-10 12:29:50 +00:00
matz
78a59da8bc
* enumerator.c: move implementation of each_slice, each_cons,
...
each_with_object to enum.c.
* enum.c (each_slice_i): convert multiple values from yield into
an array.
* enum.c (each_cons_i): ditto.
* enum.c (each_with_object_i): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 01:29:44 +00:00
akr
f7d5887fdb
unused variable removed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02 15:14:34 +00:00
matz
970e90dd15
* enum.c (enum_each_entry): new method #each_entry to pack values
...
from yield into an array.
* lib/set.rb (Set#merge): use Enumerable#each_entry to implement
Set compatible to 1.8 behavior. [ruby-core:27985]
* lib/set.rb: replace is_a?(Enumerable) with respond_to?(:each)
for duck typing.
* lib/set.rb (SortedSet#add): typo fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02 08:54:52 +00:00
akr
b9e0294eda
fix typos.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
matz
c0a0aa0c47
* enum.c (enum_count): remove optimization using #size.
...
revert r25560.
* vm_eval.c (rb_funcall_no_recursive): remove method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 16:14:38 +00:00
matz
7f2ef1a96e
* enum.c (enum_count): call #size using rb_funcall_no_recursive()
...
to prevent infinite recursive calls. [ruby-core:24794]
* vm_eval.c (rb_funcall_no_recursive): utility function to check
direct recursive call.
* vm_eval.c (rb_check_funcall): move from eval.c. [refactoring]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 17:16:05 +00:00
matz
0580ba0611
* array.c (rb_ary_to_ary): do not use #respond_to? to detect
...
to_ary. Just call. [ruby-core:23738]
* eval.c (rb_check_funcall): new function with method existence
check. returns Qundef when the method does not exist.
* enumerator.c (enumerator_rewind): just call method, using
rb_check_funcall(). [ruby-core:23738]
* error.c (exc_equal): ditto.
* object.c (convert_type): ditto.
* error.c (rb_name_err_mesg_new): export function.
* eval.c (make_exception): ditto.
* io.c (pop_last_hash): return early when the last argument is nil.
* io.c (rb_io_puts): treat T_STRING specially for small
optimization.
* vm_eval.c (raise_method_missing): skip method call if possible
using rb_method_basic_definition_p().
* vm_eval.c (method_missing): ditto.
* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
suites changed to ignore exceptions caused by just-call policy.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
matz
55bf7f9d40
* enum.c (enum_flat_map): new method that concatenates the values
...
from given block. also provides alias #collect_concat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 17:01:38 +00:00
akr
3e54f0ee1f
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 07:39:17 +00:00
akr
31959b52ef
* enum.c (slicebefore_ii): use id_eqq.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 23:29:03 +00:00
marcandre
51b89eeb03
enum.c (enum_chunk): Give proper error message if no block given. cf [ruby-core:25912]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 04:55:00 +00:00
akr
a21b7ddf26
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 23:10:38 +00:00
akr
5bdef2f984
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 23:02:04 +00:00
akr
2e70b9e70d
* enum.c (enum_slice_before): take a pattern if no block given.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 11:50:11 +00:00
akr
e9c728fea3
update rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 10:54:31 +00:00
akr
9278fab680
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 14:44:43 +00:00
akr
50bbca9d5c
* enum.c (enum_minmax): use struct for memo.
...
(enum_minmax_by): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 02:28:57 +00:00
akr
0ff9cf3625
fix rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 01:58:07 +00:00
akr
fdb3e278f5
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 18:29:53 +00:00
akr
e6f4473316
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-24 10:35:35 +00:00
akr
fc58a6c5bd
* enum.c (enum_minmax): reduce comparison.
...
(enum_minmax_by): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 15:19:13 +00:00
akr
475074d5da
* enum.c (enum_chunk): new method Enumerable#chunk.
...
* enum.c (enum_slice_before): new method Enumerable#slice_before.
[ruby-dev:38392] [ruby-dev:39240]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-22 01:35:53 +00:00
nobu
e07cb859cc
* suppressed shorten-64-to-32 warnings.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu
af8f8e5b0e
* array.c (recursive_join): use obj to tell if recursion occurs.
...
[ruby-core:24150]
* enum.c (enum_join): reverted r23966. [ruby-core:24196]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 07:30:08 +00:00
nobu
0f2d1527ab
* enum.c (DEFINE_ENUMFUNCS): included function signature.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 04:36:50 +00:00
nobu
e895bc3cdb
* enum.c (rb_enum_join): non-nil separator must be convertible to
...
String. [ruby-core:24172]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 04:34:34 +00:00
matz
9041ac4289
* enum.c (rb_enum_join): should propagate taint to the return
...
value. the change was overridden by r23967. [ruby-core:24176]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 03:55:18 +00:00
matz
8c7f7c29b4
* enum.c (enum_to_a): should propagate taint to the return value.
...
[ruby-core:24152]
* enum.c (enum_sort_by): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 01:03:16 +00:00
nobu
def66ceca3
* enum.c (enum_join): deals with self recursive objects to get rid
...
of infinite recursion. [ruby-core:24150]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 00:04:56 +00:00
nobu
e86d1ce77e
* enum.c (enum_join): added rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 23:15:51 +00:00
matz
9d9986d25c
* enum.c (enum_join): add Enumerable#join.
...
* array.c (ary_join_1): recursive join for Enumerators (and
objects with #to_a).
* array.c (rb_ary_join): performance tune.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 18:14:33 +00:00
nobu
01430b6e69
* enum.c (enum_grep): gets rid of type-punning calls.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 21:47:14 +00:00
matz
304c060d4a
* enum.c (first_i): wrong condition for no argument #first.
...
[ruby-core:24017]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 22:46:35 +00:00
matz
cab726cfac
* enum.c (enum_first): should check negative length.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-03 00:06:40 +00:00
matz
967001d9da
* enum.c (first_i): Enumerator#first should consume only what is
...
needed. a patch from Marc-Andre Lafortune. [ruby-core:23661]
* enum.c (enum_first): call to_int once for an argument. based on
a patch from Marc-Andre Lafortune.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-03 00:02:14 +00:00
nobu
82f2e90d07
* enum.c (collect_all): checks interrupts. [ruby-core:23594]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-29 00:30:02 +00:00
nobu
1da3e0f992
* enum.c (zip_ary): should use long.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 08:58:56 +00:00
nobu
12d2c8ba41
stripped trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu
cab67c3197
* array.c (take_items), enum.c (enum_zip): tries to convert to
...
array first. [ruby-core:21442]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 21:47:48 +00:00
ko1
2e311f6bd5
* include/ruby/node.h, node.h: move node.h from include path.
...
This change stop to install node.h beacuase of saving ABI
(node.h will be changed. Extensions should not depends on
this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
nobu
51e0bcb72a
* enum.c (enum_take): get rid of extraneous iteration.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 13:24:51 +00:00
nobu
5f9c188d97
* include/ruby/ruby.h (rb_intern_const): tiny optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
matz
97c8c1fa0e
* enum.c (sort_by_i): use NODE_DOT2 instead of NODE_MEMO to avoid
...
extra calls to is_pointer_to_heap() in GC.
* enum.c (enum_zip): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 04:02:36 +00:00
nobu
5a647a3f5f
* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
...
* *.c: no cache in init functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
knu
3a3e250975
* enum.c (enum_count, count_all_i, Init_Enumerable),
...
array.c (rb_ary_count): If no argument or block is given, count
the number of all elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29 19:18:54 +00:00
knu
fc19d23c5d
* enum.c (enum_to_a): Pass arguments through to #each().
...
(enum_sort): Follow the enum_to_a signature change.
(enum_reverse_each): Add #reverse_each().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:15:44 +00:00
knu
16ddb4f689
Cosmetic.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 03:25:51 +00:00
nobu
1072cb65c9
* enum.c (enum_yield): use rb_yield_values2.
...
* enum.c (DEFINE_ENUMFUNCS): macro to define enumerator and yielding
functions.
* enum.c (enum_all_func, enum_any_func, enum_one_func,
enum_none_func): reduced duplicate code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-13 14:32:46 +00:00
knu
d701d21dbe
* enum.c (grep_i): Be aware of multiple values;
...
fix [ruby-dev:34653].
(grep_iter_i): Ditto.
(count_i): Ditto.
(find_i): Ditto.
(find_index_i): Ditto.
(find_all_i): Ditto.
(reject_i): Ditto.
(inject_i): Ditto.
(inject_op_i): Ditto.
(partition_i): Ditto.
(group_by_i): Ditto.
(first_i): Ditto.
(sort_by_i): Ditto.
(all_i): Ditto.
(all_iter_i): Ditto.
(any_i): Ditto.
(any_iter_i): Ditto.
(one_i): Ditto.
(one_iter_i): Ditto.
(none_i): Ditto.
(none_iter_i): Ditto.
(min_i): Ditto.
(min_ii): Ditto.
(max_i): Ditto.
(max_ii): Ditto.
(minmax_i): Ditto.
(minmax_ii): Ditto.
(min_by_i): Ditto.
(max_by_i): Ditto.
(minmax_by_i): Ditto.
(member_i): Ditto.
(take_i): Ditto.
(take_while_i): Ditto.
(drop_i): Ditto.
(drop_while_i): Ditto.
(cycle_i): Ditto.
* enum.c (each_with_index): Update rdoc. each_with_index() takes
argments that are passed through to each(), and a hash preserves
key order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 11:21:39 +00:00
nobu
8481c848da
* enum.c (all_iter_i, any_iter_i): reduced duplicated code.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 14:19:41 +00:00
nobu
93df43f8ae
* enum.c: removed trailing garbage spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 14:10:20 +00:00
knu
181f815591
* enum.c (enum_cycle): Make Enumerable#cycle do a finite loop when
...
the number of cycles is specified.
* array.c (rb_ary_cycle): Ditto for Array#cycle.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-13 14:59:55 +00:00
matz
3734fd0e79
* enum.c (count_i): modified to shut warning up.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:36:47 +00:00
knu
f9c5484cc5
* enum.c (count_i, count_iter_i, enum_count, enum_find_index):
...
Reduce code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:26:45 +00:00
matz
f79e9281ff
* enum.c (find_index_i): modified to shut warning up.
...
* enum.c (find_index_iter_i): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:06:31 +00:00
knu
033a32b4c1
* enum.c (enum_find_index): Add support for find_index(obj);
...
[ruby-dev:34313].
* array.c (rb_ary_index): Define find_index as an alias to index.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 07:58:06 +00:00
mame
b6c9957058
* array.c (ary_new): fix size check. [ruby-dev:34123]
...
* array.c (rb_ary_take, rb_ary_drop): check negative size and use
NUM2LONG instead of FIX2LONG. [ruby-dev:34123]
* enum.c (enum_take, enum_drop): check negative size.
* test/ruby/test_array.rb: add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 10:13:03 +00:00
matz
1d2078824f
* enum.c (zip_ary): wrong boundary condition.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-13 16:38:23 +00:00
matz
2b1b74a099
* enum.c (enum_zip): optimize if all arguments are arrays.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11 16:20:44 +00:00
akr
861219ce4a
fix doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
matz
39787ea14d
* numeric.c (fix_to_s): avoid rb_scan_args() when no argument
...
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
2008-03-05 05:22:17 +00:00
mame
0dba38026a
* enum.c (enum_one, enum_take_while, enum_drop_while): fix documents.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 14:23:51 +00:00
jeg2
8ed70a5186
* enum.c: Updating the documentation of Enumrable#zip to reflect
...
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
2008-01-08 23:42:38 +00:00
matz
929faf7906
* enum.c (enum_zip): honor length of the receiver, not the
...
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
2008-01-08 09:50:01 +00:00
akr
6cdef2dc7e
* $Date$ keyword removed to avoid inclusion of locale dependent
...
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr
5088b14db7
fix typos.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 06:43:32 +00:00
matz
f46baadb56
* enum.c (collect_all): should pack all values. [ruby-core:14410]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:22:27 +00:00
matz
54cf2fca17
* enum.c (enum_yield): when multiple values yielded from #each
...
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
2007-12-25 06:01:22 +00:00
matz
9bfdc4e736
* enum.c (enum_inject): updated documentation. a patch from Keita
...
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
2007-12-23 20:35:12 +00:00
akr
d4463c42c0
* enum.c (enum_count): suppress warning.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 08:53:20 +00:00
matz
9497f7996a
* enum.c (enum_count): precise argument number check.
...
* 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
2007-11-30 10:08:03 +00:00
matz
58c070aa9b
* enum.c (enum_take_while): returns Enumerator if no block given.
...
* enum.c (enum_drop_while): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 08:15:12 +00:00
matz
c23d672932
* enum.c (each_with_index_i): use rb_yield_values() for
...
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
2007-11-09 04:59:07 +00:00
nobu
ec0187ef15
* enum.c (enum_each_with_index): make different arrays at each
...
iteration. [ruby-dev:32181]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-07 06:07:52 +00:00
davidflanagan
d04b7871a1
* enum.c (take_while_i, drop_while_i) add RTEST to handle nil return
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-01 05:53:52 +00:00
usa
4905959e34
* enum.c (enum_drop): fix typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-31 16:53:04 +00:00
matz
d2a1637d90
* enum.c (enum_take_while): separate with-block form.
...
* 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
2007-10-30 23:43:26 +00:00
matz
a68451d610
* enum.c (enum_butfirst): add a new method to iterates over
...
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
2007-10-30 01:06:10 +00:00
matz
15112cf003
* enum.c (enum_cycle): hide temporary array from ObjectSpace.
...
[ruby-core:12762]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-22 15:29:17 +00:00
matz
0c7d366e47
* enum.c (enum_find_index): update RDoc. a patch from David Flanagan
...
<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
2007-10-18 08:12:27 +00:00
matz
fada885be6
* range.c (range_first): takes first n element if argument is
...
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
2007-10-18 06:58:35 +00:00
matz
8cb190c416
* enum.c (enum_inject): RDoc update. a patch from David Flanagan
...
<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
2007-10-15 16:41:30 +00:00
matz
a25fbe3b3e
* encoding.c: provide basic features for M17N.
...
* 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
2007-08-25 03:29:39 +00:00
matz
e2de7c70dc
* enum.c (enum_cycle): typo fixed. a patch from Kazuhiro
...
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
2007-08-08 17:03:33 +00:00
matz
c186fdb90b
* enumerator.c (enumerator_next_p): should check correctly even when
...
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
2007-08-08 07:07:03 +00:00
matz
ecb93c3fdf
* enum.c (enum_zip): zip no longer converts arguments into
...
arrays, uses enumerators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:53:36 +00:00
matz
b3e977a4c0
* enum.c (enum_cycle): new method to cycle enumerable forever.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:26:17 +00:00
nobu
a594151668
* enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 05:04:09 +00:00
akr
1fb587ddec
* enum.c (enum_minmax): fix SEGV by [].minmax.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-23 18:10:59 +00:00
matz
3f2fe37200
* enum.c (enum_minmax): new method to get the minimum and maximum
...
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
2007-06-23 15:05:05 +00:00
nobu
2b592580bf
* include/ruby: moved public headers.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
matz
3d7439d568
* enum.c (each_with_index_i): should work well with continuation.
...
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
2007-05-31 16:59:12 +00:00
nobu
3d18c14e2c
* enum.c (enum_inject): minor improvement. [ruby-dev:30792]
...
* 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
2007-05-18 18:06:54 +00:00
matz
9eec640e9d
* enum.c (enum_inject): it is now can work without block. you
...
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
2007-05-18 16:10:46 +00:00
matz
e7bab2a61b
* enum.c (enum_each_with_index): each_with_index to forward
...
arguments to each. [ruby-core:10921]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-16 07:29:30 +00:00
matz
b2c25d56c5
* enum.c (take_i): small cosmetic / documentation patch from
...
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
2007-02-27 19:04:52 +00:00
matz
60c3c901fe
* enum.c (enum_take): new method. [ruby-dev:30407]
...
* enum.c (enum_drop): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-27 09:19:21 +00:00
matz
5ba0254777
* enum.c (enum_each_with_index): reuse array for yield parameters.
...
* enum.c (enum_min, enum_max): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-29 19:49:23 +00:00