Method: Bundler::CompactIndexClient::CacheFile.copy

Defined in:
lib/bundler/compact_index_client/cache_file.rb

.copy(path, &block) ⇒ Object

Initialize with a copy of the original file, then yield the instance.



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bundler/compact_index_client/cache_file.rb', line 24

def self.copy(path, &block)
  new(path) do |file|
    file.initialize_digests

    SharedHelpers.filesystem_access(path, :read) do
      path.open("rb") do |s|
        file.open {|f| IO.copy_stream(s, f) }
      end
    end

    yield file
  end
end