Class: IOStreams::SymmetricEncryption::Writer

Inherits:
Writer
  • Object
show all
Defined in:
lib/io_streams/symmetric_encryption/writer.rb

Instance Attribute Summary

Attributes inherited from Writer

#output_stream

Class Method Summary collapse

Methods inherited from Writer

#initialize, open

Constructor Details

This class inherits a constructor from IOStreams::Writer

Class Method Details

.file(file_name, compress: nil, **args, &block) ⇒ Object

Write to stream using Symmetric Encryption By default the output stream is compressed unless the file_name extension indicates the file is already compressed.



17
18
19
20
21
22
23
# File 'lib/io_streams/symmetric_encryption/writer.rb', line 17

def self.file(file_name, compress: nil, **args, &block)
  unless defined?(SymmetricEncryption)
    Utils.load_soft_dependency('symmetric-encryption', '.enc streaming')
  end

  ::SymmetricEncryption::Writer.open(file_name, compress: compress, **args, &block)
end

.stream(input_stream, compress: true, **args, &block) ⇒ Object

Write to stream using Symmetric Encryption By default the output stream is compressed. If the input_stream is already compressed consider setting compress: false.



7
8
9
10
11
12
13
# File 'lib/io_streams/symmetric_encryption/writer.rb', line 7

def self.stream(input_stream, compress: true, **args, &block)
  unless defined?(SymmetricEncryption)
    Utils.load_soft_dependency('symmetric-encryption', '.enc streaming')
  end

  ::SymmetricEncryption::Writer.open(input_stream, compress: compress, **args, &block)
end