Method: Rnp::Encrypt#compression=

Defined in:
lib/rnp/op/encrypt.rb

#compression=(compression) ⇒ Object

Set the compression algorithm and level.

Parameters:

  • compression (Hash<Symbol>)

Options Hash (compression):

  • :algorithm (String)

    the compression algorithm (bzip2, etc)

  • :level (Integer)

    the compression level. This should generally be between 0 (no compression) and 9 (best compression).



120
121
122
123
124
125
126
127
# File 'lib/rnp/op/encrypt.rb', line 120

def compression=(compression)
  if !compression.is_a?(Hash) || Set.new(compression.keys) != Set.new(%i[algorithm level])
    raise ArgumentError,
          'Compression option must be of the form: {algorithm: \'zlib\', level: 5}'
  end
  Rnp.call_ffi(:rnp_op_encrypt_set_compression, @ptr,
               compression[:algorithm], compression[:level])
end