Sha256: 75c8de578de75606fd652efdf5061aad2b92c04ba0d1d6e5f6d384105c2508fc
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# typed: false # frozen_string_literal: true require 'parallel' module Frontman class Iterator class << self extend T::Sig def map(collection, *options, &block) forward(:map, collection, *options, &block) end def each(collection, *options, &block) forward(:each, collection, *options, &block) end def map_with_index(collection, *options, &block) forward(:map_with_index, collection, *options, &block) end def each_with_index(collection, *options, &block) forward(:each_with_index, collection, *options, &block) end def processor_count return Parallel.processor_count if parallel? Frontman::Config.get(:processor_count, fallback: 1) end private def parallel? Frontman::Config.get(:parallel, fallback: true) end def forward(method, collection, *options, &block) if parallel? return ::Parallel.public_send(method, collection, *options, &block) end collection.public_send(method, &block) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
frontman-ssg-0.0.2 | lib/frontman/iterator.rb |