Method: Immutable::Vector#flat_map

Defined in:
lib/immutable/vector.rb

#flat_mapVector

Return a new Vector with the concatenated results of running the block once for every element in this Vector.

Examples:

Immutable::Vector[1, 2, 3].flat_map { |x| [x, -x] }
# => Immutable::Vector[1, -1, 2, -2, 3, -3]

Returns:



513
514
515
516
517
# File 'lib/immutable/vector.rb', line 513

def flat_map
  return enum_for(:flat_map) if not block_given?
  return self if empty?
  self.class.new(super)
end