Sha256: 9256a5d702ac63b5a13f6be7151a3dee1981c7746a186bb0df82099d2455c188

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

require_relative 'zip_package'

module Resync
  # Extends {ChangeDump} and {ResourceDump} to provide
  # transparent access to the linked bitstream packages
  module Dump
    # Injects a +:zip_package+ method into each resource,
    # downloading the (presumed) bitstream package to a
    # temp file and returning it as a {ZipPackage}
    def resources=(value)
      super
      resources.each do |r|
        def r.zip_package
          @zip_package ||= ZipPackage.new(download_to_temp_file)
        end
      end
    end

    # A list of the {ZipPackage}s for each resource
    # @return [Array<ZipPackage>] the zip packages for each resource
    def zip_packages
      resources.map(&:zip_package)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resync-client-0.1.1 lib/resync/client/dump.rb
resync-client-0.1.0 lib/resync/client/dump.rb