Class: IOStreams::SymmetricEncryption::Reader
- Inherits:
-
Object
- Object
- IOStreams::SymmetricEncryption::Reader
- Defined in:
- lib/io_streams/symmetric_encryption/reader.rb
Class Method Summary collapse
-
.open(file_name_or_io, **args, &block) ⇒ Object
read from a file/stream using Symmetric Encryption.
Class Method Details
.open(file_name_or_io, **args, &block) ⇒ Object
read from a file/stream using Symmetric Encryption
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/io_streams/symmetric_encryption/reader.rb', line 5 def self.open(file_name_or_io, **args, &block) begin require 'symmetric-encryption' unless defined?(SymmetricEncryption) rescue LoadError => e raise(LoadError, "Please install the 'symmetric-encryption' gem for .enc streaming support. #{e.}") end if IOStreams.reader_stream?(file_name_or_io) ::SymmetricEncryption::Reader.open(file_name_or_io, **args, &block) else IOStreams::File::Reader.open(file_name_or_io) do |file| ::SymmetricEncryption::Reader.open(file, **args, &block) end end end |