Граф коммитов

233 Коммитов

Автор SHA1 Сообщение Дата
eregon bd14f5bf94 * enum.c (Enumerable#chunk): fix grammar of error message
for symbols beginning with an underscore [Bug #8351]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 10:04:21 +00:00
nobu 9f87297c21 enum.c: avoid inadvertent symbol creation
* enum.c (enum_inject): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 06:46:53 +00:00
zzak d2c218d559 * enum.c (Enumerable#chunk: Improved examples, grammar, and formatting
Patch by Dan Bernier and Rich Bruchal of newhaven.rb
  [Github documenting-ruby/ruby#8]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22 02:11:26 +00:00
marcandre 1677cbce9d * enumerator.c: Use to_enum for Enumerable methods returning Enumerators.
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
2013-02-05 03:49:59 +00:00
marcandre 96af5360a4 * enum.c (enum_zip): Fix error message
* array.c (take_items): Same, for Array#zip
  [Bug #7706]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:51:05 +00:00
ko1 f6f388a5bd * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
range.c: use prepared IDs.
  A patch from charliesome (Charlie Somerville).
  [Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 09:57:47 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
nobu db54dc7215 enum.c: prefix
* 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
2012-11-06 22:52:52 +00:00
marcandre 0814c4ac64 * enumerator.c: Support for lazy.cycle.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:58 +00:00
marcandre cef054d5b2 * enum.c (enum_cycle): Support for Enumerable#cycle.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:13:19 +00:00
marcandre fe9386cdcb * enum.c (enum_each_cons): Support for Enumerable#each_cons.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:13:04 +00:00
marcandre df8451e606 * enum.c (enum_each_slice): Support for Enumerable#each_slice.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:12:50 +00:00
marcandre c82ad6d207 * enum.c: Support for enumerators created by Enumerable with forwarding:
find_all, reject, ...
  [Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:12:35 +00:00
nobu a7353f6924 enum.c: id_call
* enum.c (enum_find): use id_call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 01:18:22 +00:00
nobu 8a3856dc1e enum.c: id_call
* enum.c (id_call): intern first and share.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 01:16:36 +00:00
nobu abeedb0875 array.c, enum.c: TypeError in zip
* array.c (take_items), enum.c (enum_zip): raise TypeError at
  non-enumerable objects, not NoMethodError.  [ruby-dev:46145]
  [Bug #7038]
* vm_eval.c (rb_check_block_call): check_funcall variant with block
  function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19 15:42:26 +00:00
zzak 1ae1b85e81 * array.c (rb_ary_select):
Update documentation for Array#select
* enum.c (enum_find_all, enum_reject):
  Update documentation for Enumerable#find_all and Enumerable#reject
  Based on a patch by Jeff Saracco
  [Bug #6908] [ruby-core:47285] [Fixes #166 on github]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-13 18:32:07 +00:00
ayumin 8198cca945 Merge branch 'pullreq/129' into trunk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-18 16:28:42 +00:00
drbrain 38f0dd0aba * enum.c (enum_count): Enumerable#count no longer uses #size when
counting elements.  Patch by Nobuhiro IMAI.  [ruby-trunk - Bug #6473]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 23:51:56 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
shugo 592a629bd0 * enum.c (zip_i): variadic argument needs explicit cast on the
platforms where VALUE is longer than int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-19 07:39:12 +00:00
nobu 19451891d8 * enum.c (enum_take): allocate buffer array before iteration, as well
as enum_first did.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 08:33:10 +00:00
nobu a920c29c16 * enum.c (enum_first): remove duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 06:02:37 +00:00
shugo 2baeb78294 * enum.c (rb_enum_values_pack): rename from enum_values_pack, and
remove static.

* enumerator.c (lazy_init_iterator, lazy_init_yielder,
  lazy_select_func, lazy_reject_func, lazy_grep_func): handle
  multiple values correctly.

* enumerator.c (lazy_grep): change the behavior when a block is
  given, to be consistent with Enumerable#grep.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 14:20:27 +00:00
shugo 0b35e9e5dd * enumerator.c (lazy_take): add Enumerable::Lazy#take.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 10:29:25 +00:00
nobu 5362e7fcdd * enum.c (enum_each_slice): arrays to be yielded can be newly
created in the block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 06:20:56 +00:00
nobu 41e331cc36 * enum.c: move work variables to objects not to let called blocks
access stack area out of scope.  [Bug #5801]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 04:24:48 +00:00
nobu f5d724ab19 * enum.c (id_lshift): use constant ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-16 22:33:31 +00:00
akr 3b1276eb39 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-09 13:18:26 +00:00
akr de25f35c98 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08 15:44:41 +00:00
drbrain 2a4ce0757d * enum.c: Reformat block args to a single standard, { |args| ... }.
Patch by b t.  [Ruby 1.9 - Bug #5393]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 02:07:50 +00:00
drbrain 82f1f640ec * enum.c (group_by): Improve group_by description. Patch by b t. [#5411]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-07 23:55:41 +00:00
drbrain 8f6cb4b473 * enum.c (group_by): Improve documentation based on patch by b t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 01:01:22 +00:00
drbrain e2974b1a4b * enum.c: Clean up wording in Enumerable documentation. Patch by b t.
[Ruby 1.9 - Bug #5411


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 00:57:06 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
naruse 73220a234e * enum.c (slice_before_i): use rb_attr_get to surpress wrong warning
for internal instance variable slicebefore_initial_state.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-24 18:43:32 +00:00
naruse 579f2a0aa8 * enum.c (enum_inject): remove empty line to notify rdoc
Enumerable#reduce is alias. patched by milki@github.
  https://github.com/ruby/ruby/pull/26

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-21 09:12:36 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
matz 00e84afa33 * enum.c (enum_inject): typo fixed. a patch from Gaku Ueda in
[ruby-core:35216].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 22:41:02 +00:00
akr e1680f8cc1 * enum.c (sort_by_i): reenter check more strictly.
(sort_by_cmp): ditto.
  [ruby-dev:43003] reported by Usaku NAKAMURA.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:27:48 +00:00
akr 5a17f4c4a3 fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11 11:34:12 +00:00
akr 113f27ba68 * enum.c (enum_sort_by): use rb_ary_resize.
(ary_cutoff): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 12:48:12 +00:00
akr 74b08ff339 * enum.c (enum_sort_by): use less temporary objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-31 03:02:53 +00:00
akr e8fc308315 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30 02:58:42 +00:00
nobu 786e4ce25a * enum.c: use constants in id.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30 00:40:56 +00:00
naruse 5c132d0ad2 * enum.c (enum_zip): fix typo of rdoc.
patched by Andrei Kulakov [ruby-core:31974]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-01 05:36:31 +00:00
naruse fee5e4ff5f * enum.c (enum_inject): fix typo of rdoc.
patched by Andrei Kulakov [ruby-core:31768]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-19 02:12:32 +00:00
marcandre 165ebcd5ac * enum.c (zip): rdoc fix, patch by okkez [ruby-dev:41737]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-27 03:10:20 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
marcandre c5b5ab0935 * enum.c: Documentation: small fixes
* file.c: ditto

* io.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:51:01 +00:00