Skip to content

Commit

Permalink
* enum.c: New methods: Enumerable#one?, #none?, #minmax, #min_by,
Browse files Browse the repository at this point in the history
  #max_by, #minmax_by and #cycle; backported from 1.9.

* enum.c (enum_find_index): Add support for find_index(obj);
  [ruby-dev:34313]; backported from 1.9.

* enum.c (enum_inject): Add support for Enumerable#inject(:binop);
  backported from 1.9.

* enum.c: Alias Enumerable#reject to #inject; backported from 1.9.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@16011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
knu committed Apr 14, 2008
1 parent a5a4f71 commit 1e46931
Show file tree
Hide file tree
Showing 3 changed files with 518 additions and 37 deletions.
24 changes: 18 additions & 6 deletions ChangeLog
@@ -1,7 +1,20 @@
Mon Apr 14 18:50:15 2008 Akinori MUSHA <knu@iDaemons.org>

* enum.c: New methods: Enumerable#one?, #none?, #minmax, #min_by,
#max_by, #minmax_by and #cycle; backported from 1.9.

* enum.c (enum_find_index): Add support for find_index(obj);
[ruby-dev:34313]; backported from 1.9.

* enum.c (enum_inject): Add support for Enumerable#inject(:binop);
backported from 1.9.

* enum.c: Alias Enumerable#reject to #inject; backported from 1.9.

Mon Apr 14 18:14:19 2008 Akinori MUSHA <knu@iDaemons.org>

* enum.c (enum_find, enum_reject): Return an enumerator if no
block is given.
block is given; backported from 1.9.

* io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach,
argf_each_line, argf_each_byte): Ditto.
Expand All @@ -15,10 +28,9 @@ Mon Apr 14 18:10:05 2008 NAKAMURA Usaku <usa@ruby-lang.org>
Mon Apr 14 17:55:30 2008 Akinori MUSHA <knu@iDaemons.org>

* array.c (rb_ary_collect_bang, rb_ary_select): Return an
enumerator if no block is given.
enumerator if no block is given; backported from 1.9.

* dir.c (dir_each, dir_foreach): Return an enumerator if no block
is given.
* dir.c (dir_each, dir_foreach): Ditto.

* enum.c (enum_partition, enum_sort_by): Ditto.

Expand Down Expand Up @@ -52,7 +64,7 @@ Mon Apr 14 14:16:08 2008 NAKAMURA Usaku <usa@ruby-lang.org>
Mon Apr 14 13:58:32 2008 Akinori MUSHA <knu@iDaemons.org>

* string.c (rb_str_each_char): New methods: String#chars and
#each_char.
#each_char; backported from 1.9.

Mon Apr 14 13:42:20 2008 Akinori MUSHA <knu@iDaemons.org>

Expand All @@ -63,7 +75,7 @@ Mon Apr 14 13:42:20 2008 Akinori MUSHA <knu@iDaemons.org>
Mon Apr 14 13:19:36 2008 Akinori MUSHA <knu@iDaemons.org>

* range.c (range_each, range_step): Return an enumerator if no
block is given.
block is given; backported from 1.9.

* struct.c (rb_struct_each, rb_struct_each_pair): Ditto.

Expand Down
15 changes: 15 additions & 0 deletions NEWS
Expand Up @@ -62,9 +62,16 @@ with all sufficient information, see the ChangeLog file.
New methods for various enumeration defined by the enumerator library.

* Enumerable#count
* Enumerable#cycle
* Enumerable#find_index
* Enumerable#first
* Enumerable#group_by
* Enumerable#max_by
* Enumerable#min_by
* Enumerable#minmax
* Enumerable#minmax_by
* Enumerable#none?
* Enumerable#one?

New methods.

Expand All @@ -77,6 +84,14 @@ with all sufficient information, see the ChangeLog file.

Return an enumerator if no block is given.

* Enumerable#inject

Accepts a binary operator instead of a block.

* Enumerable#reduce

New alias to #inject.

* Hash#delete_if
* Hash#each
* Hash#each_key
Expand Down

0 comments on commit 1e46931

Please sign in to comment.