[ruby-cvs:78609] 85e43e1dfe (master): Fix Enumerator::Lazy#with_index

"Jeremy Evans" <[email protected]>
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
Jeremy Evans	2019-12-11 06:38:12 +0900 (Wed, 11 Dec 2019)

  New Revision: 85e43e1dfe

  https://github.com/ruby/ruby/commit/85e43e1dfe

  Log:
    Fix Enumerator::Lazy#with_index
    
    * Make it correctly handle lambdas
    * Make it iterate over the block if block is given
    
    The original implementation was flawed, based on lazy_set_method
    instead of lazy_add_method.
    
    Note that there is no implicit map when passing a block, the return
    value of the block passed to with_index is ignored, just as it
    is for Enumerator#with_index. Also like Enumerator#with_index,
    when called with a block, the return value is an enumerator without
    the index.
    
    Fixes [Bug #16414]

  Modified files:
    enumerator.c
    test/ruby/test_lazy_enumerator.rb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.