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.



15
16
17
18
19
# File 'lib/io_streams/symmetric_encryption/writer.rb', line 15

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

  ::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
# File 'lib/io_streams/symmetric_encryption/writer.rb', line 7

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

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