Sha256: 3896150425cba279fbb7e054b4edabd9edbab97323cc4208d6954c7b0f13c12c
Contents?: true
Size: 603 Bytes
Versions: 9
Compression:
Stored size: 603 Bytes
Contents
# encoding: UTF-8 module Enumerable def mapcat(initial = [], &block) reduce(initial) do |a, e| block.call(e).each do |x| a << x end a end end def pmapcat(initial = [], &block) intermediate = pmap(&block) intermediate.reduce(initial) do |a, e| e.each do |x| a << x end a end end def pselect(&block) intermediate = pmap(&block) zip(intermediate).select { |x| x[1] }.map(&:first) end def rjust(n, x) Array.new([0, n - length].max, x) + self end def ljust(n, x) dup.fill(x, length...n) end end
Version data entries
9 entries across 9 versions & 1 rubygems