Module: Twitter::Utils Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Utility methods for parallel mapping

Class Method Summary collapse

Class Method Details

.flat_pmap(enumerable, &block) ⇒ Array, Enumerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parallel flat_map for enumerables

Parameters:

Returns:

  • (Array, Enumerator)


11
12
13
14
15
# File 'lib/twitter/utils.rb', line 11

def flat_pmap(enumerable, &block)
  return to_enum(:flat_pmap, enumerable) unless block

  pmap(enumerable, &block).flatten(1)
end

.pmap(enumerable) ⇒ Array, Enumerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parallel map for enumerables

Parameters:

Returns:

  • (Array, Enumerator)


23
24
25
26
27
# File 'lib/twitter/utils.rb', line 23

def pmap(enumerable, &)
  return to_enum(:pmap, enumerable) unless block_given?

  enumerable.collect(&)
end