lib/resync/client/zip/zip_packages.rb in resync-client-0.2.3 vs lib/resync/client/zip/zip_packages.rb in resync-client-0.2.4

- old
+ new

@@ -1,7 +1,7 @@ require 'resync' -require_relative '../../extensions' +require_relative '../mixins' require_relative 'zip_package' module Resync class Client module Zip @@ -51,9 +51,19 @@ def each @resources.lazy.each do |resource| yield package_for(resource) end end + + # Eagerly gets the zip package for each resource, downloading + # as necessary. (For compatbility with {::Enumerator::Lazy#flat_map}) + # @return [Array<ZipPackage>] the zip package for each resource + def force + @resources.map { |r| package_for(r) }.to_a + end + + # Alias for {#force} (for compatbility with {::Enumerable#flat_map}) + alias_method :to_ary, :force end end end end