diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-14 08:57:23 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-14 08:57:23 +0000 |
commit | 125d830eb8525151861e932f4a01e76ac5c8b25e (patch) | |
tree | 74f570eb217648b78bdf3a83160548d8139652e0 /numeric.c | |
parent | 39df01c4af5fa7e4246f2a951e4fcc73a3a6aee0 (diff) |
* array.c (rb_ary_collect_bang, rb_ary_select): Return an
enumerator if no block is given.
* dir.c (dir_each, dir_foreach): Return an enumerator if no block
is given.
* enum.c (enum_partition, enum_sort_by): Ditto.
* gc.c (os_each_obj): Ditto.
* hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select,
rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair,
env_each_key, env_each_value, env_each, env_each_pair,
env_reject_bang, env_delete_if, env_select): Ditto.
* numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1463,6 +1463,8 @@ num_step(argc, argv, from) { VALUE to, step; + RETURN_ENUMERATOR(from, argc, argv); + if (argc == 1) { to = argv[0]; step = INT2FIX(1); @@ -2845,6 +2847,8 @@ static VALUE int_upto(from, to) VALUE from, to; { + RETURN_ENUMERATOR(from, 1, &to); + if (FIXNUM_P(from) && FIXNUM_P(to)) { long i, end; @@ -2884,6 +2888,8 @@ static VALUE int_downto(from, to) VALUE from, to; { + RETURN_ENUMERATOR(from, 1, &to); + if (FIXNUM_P(from) && FIXNUM_P(to)) { long i, end; @@ -2924,6 +2930,8 @@ static VALUE int_dotimes(num) VALUE num; { + RETURN_ENUMERATOR(num, 0, 0); + if (FIXNUM_P(num)) { long i, end; |