Sha256: fb4d4c44941595e2e9ed45df4611e72281d6b3dff1c06afb203110036f091897
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# typed: false # frozen_string_literal: true require 'parallel' module Frontman class Iterator class << self 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
frontman-ssg-0.0.4 | lib/frontman/iterator.rb |
frontman-ssg-0.0.3 | lib/frontman/iterator.rb |