[ruby-cvs:73049] knu:r65949 (trunk): Implement Enumerator#+ and Enumerable#chain [Feature #15144]

knu at ruby-lang.org knu at ruby-lang.org
Sat Nov 24 17:38:35 JST 2018


knu	2018-11-24 17:38:35 +0900 (Sat, 24 Nov 2018)

  New Revision: 65949

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65949

  Log:
    Implement Enumerator#+ and Enumerable#chain [Feature #15144]
    
    They return an Enumerator::Chain object which is a subclass of
    Enumerator, which represents a chain of enumerables that works as a
    single enumerator.
    
    ```ruby
    e = (1..3).chain([4, 5])
    e.to_a #=> [1, 2, 3, 4, 5]
    
    e = (1..3).each + [4, 5]
    e.to_a #=> [1, 2, 3, 4, 5]
    ```

  Modified files:
    trunk/enumerator.c
    trunk/test/ruby/test_enumerator.rb


More information about the ruby-cvs mailing list