Sha256: 4d2e1b9b4ca58dbb35dcce709f9126398c368f45ecf900a3c072e41f86f43be0

Contents?: true

Size: 991 Bytes

Versions: 8

Compression:

Stored size: 991 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.23 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.22 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.21 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.20 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.18 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.17 lib/uricp/strategy/piped_local_decompress.rb
uricp-0.0.16 lib/uricp/strategy/piped_local_decompress.rb