Class: Uricp::Strategy::CachedGet
- Inherits:
-
Object
- Object
- Uricp::Strategy::CachedGet
- Includes:
- CacheCommon, Common
- Defined in:
- lib/uricp/strategy/cached_get.rb
Constant Summary
Constants included from Common
Uricp::Strategy::Common::PIPE_URI
Instance Attribute Summary
Attributes included from Common
Attributes included from CurlPrimitives
Instance Method Summary collapse
Methods included from CacheCommon
#cache_exists?, #cache_file, #cache_name, #cache_root, #in_cache?, #temp_cache_file, #temp_cache_uri, #validate_cache!
Methods included from Common
#all_local_files?, #always_write_sparse?, #compression_required?, #conversion_required?, #encoding, #file_source?, #format_change?, #get_temp_filename, #initialize, #lz4?, #lz4_source?, #proposed_path, #qcow2?, #raw_target?, #segmented?, #sequence_complete?, #supported_source?, #temp_uri, #unsupported_transfer
Methods included from CurlPrimitives
#authentication, #curl_command, #curl_download_to_pipe, #curl_manifest, #curl_upload_from, #from, #from=, #http_authentication?, #to, #to=
Instance Method Details
#appropriate? ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/uricp/strategy/cached_get.rb', line 10 def appropriate? if cache_root validate_cache! if in_cache? || file_source? return proposal else debug "#{self.class.name}: no cache entry for #{['from_uri']}" end else debug "#{self.class.name}: not appropriate" end false end |
#command ⇒ Object
24 25 26 |
# File 'lib/uricp/strategy/cached_get.rb', line 24 def command ":;" end |
#proposal ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/uricp/strategy/cached_get.rb', line 28 def proposal @proposed_options = .dup unless file_source? @proposed_options['from_uri'] = URI.join('file:///', cache_file) end @proposed_options.delete('cache') @proposed_options.delete('cache_name') if conversion_required? @proposed_options['source-format'] = File.open(@proposed_options['from_uri'].path) {|f| encoding(f)} if @proposed_options['source-format'] == @proposed_options['target-format'] @proposed_options.delete('source-format') @proposed_options.delete('target-format') end end self end |