Sha256: 3cc6d11ea7a21a112577ac7a4bdfde38ad54a129c4678292a7d8623c327dd43c
Contents?: true
Size: 1.27 KB
Versions: 11
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true require 'uri' module Uricp::Strategy class CachedGet include Uricp::Strategy::Common include Uricp::Strategy::CacheCommon def appropriate? with_active_cache do validate_cache! return proposal if in_cache? || file_source? debug "#{self.class.name}: no cache entry for #{options['from_uri']}" false end end def command ':;' end def proposal @proposed_options = options.dup @proposed_options['from_uri'] = URI.join('file:///', cache_file) unless file_source? if to.scheme == 'rbd' @proposed_options['rbd_cache_name'] = rbd_cache_image_spec(to) end @proposed_options.delete('cache') @proposed_options.delete('cache_name') if conversion_required? if dry_run? @proposed_options['source-format'] = @proposed_options['target-format'] else @proposed_options['source-format'] = File.open(@proposed_options['from_uri'].path) { |f| encoding(f) } end if @proposed_options['source-format'] == @proposed_options['target-format'] @proposed_options.delete('source-format') @proposed_options.delete('target-format') end end self end end end
Version data entries
11 entries across 11 versions & 1 rubygems