Skip to content
Snippets Groups Projects
Forked from Debian / ruby-in-parallel
Source project has a limited visibility.
  • Nick Lewis's avatar
    b041b864
    (maint) Properly handle non-parallel enumerables · b041b864
    Nick Lewis authored
    For Enumerables containing 0 or 1 items, the #each_in_parallel method
    was improperly calling the block without an argument, then calling it
    again properly but not returning the result of the block.
    
    The #each method returns the Enumerable that was it was called on,
    rather than the value of the block. This needs to be #map instead, to
    actually return an array of the one or zero values. The tests weren't
    catching this because they were effectively passing `identity` as the
    block, nullifying the distinction between #each and #map.
    b041b864
    History
    (maint) Properly handle non-parallel enumerables
    Nick Lewis authored
    For Enumerables containing 0 or 1 items, the #each_in_parallel method
    was improperly calling the block without an argument, then calling it
    again properly but not returning the result of the block.
    
    The #each method returns the Enumerable that was it was called on,
    rather than the value of the block. This needs to be #map instead, to
    actually return an array of the one or zero values. The tests weren't
    catching this because they were effectively passing `identity` as the
    block, nullifying the distinction between #each and #map.