Sha256: 4d865ce1e7b043fba67513399cabf2109c42ca8f6c9237c11a04e7e545d2d348

Contents?: true

Size: 1022 Bytes

Versions: 12

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

module Uricp::Strategy
  class PipedLocalDecompress
    include Uricp::Strategy::Common

    def appropriate?
      case from.scheme
      when 'pipe'
        if raw_target? && lz4_source? && to.scheme == 'file'
          return proposal if always_write_sparse?

          debug "#{self.class.name}: using safe sparse expansion via stream"
        end
      end
      debug "#{self.class.name}: not appropriate"
      false
    end

    def command
      "lz4 -qdf - #{to.path};"
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options.delete('source-format')
      if @proposed_options['target-format']
        @proposed_options['source-format'] = :raw
        if @proposed_options['source-format'] == @proposed_options['target-format']
          @proposed_options.delete('source-format')
          @proposed_options.delete('target-format')
        end
      end
      @proposed_options['from_uri'] = @proposed_options['to_uri']
      self
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
uricp-0.0.37 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.36 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.35 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.34 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.32 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.31 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.30 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.29 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.28 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.27 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.26 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.25 lib/uricp/strategy/piped_local_decompress.rb