Class: IOStreams::SymmetricEncryption::Writer
- Defined in:
- lib/io_streams/symmetric_encryption/writer.rb
Instance Attribute Summary
Attributes inherited from Writer
Class Method Summary collapse
-
.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.
-
.stream(input_stream, compress: true, **args, &block) ⇒ Object
Write to stream using Symmetric Encryption By default the output stream is compressed.
Methods inherited from Writer
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 |