Sha256: 3020d4bbc9bb94add2007322eb5864e273bc090819260db1243cfff53c526cba

Contents?: true

Size: 760 Bytes

Versions: 6

Compression:

Stored size: 760 Bytes

Contents

module IOStreams
  module SymmetricEncryption
    class Reader
      # read from a file/stream using Symmetric Encryption
      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.message}")
        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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iostreams-0.20.3 lib/io_streams/symmetric_encryption/reader.rb
iostreams-0.20.2 lib/io_streams/symmetric_encryption/reader.rb
iostreams-0.20.1 lib/io_streams/symmetric_encryption/reader.rb
iostreams-0.20.0 lib/io_streams/symmetric_encryption/reader.rb
iostreams-0.19.0 lib/io_streams/symmetric_encryption/reader.rb
iostreams-0.18.0 lib/io_streams/symmetric_encryption/reader.rb