Sha256: c908a3cdf3de4443351bc2b725669f18ee2ce36f5c3bacd9cacc3898ab573365

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

module Shhh
  # This class encapsulates application configuration, and exports
  # a familiar method +#configure+ for defining configuration in a
  # block.
  #
  # It's values are requested by the library upon encryption or
  # decryption, or any other operation.
  #
  # == Example
  #
  # The following is an actual initialization from the code of this
  # library. You may override any of the value defined below in your
  # code, but _before_ you _use_ library's encryption methods.
  #
  #     Shhh::Configuration.configure do |config|
  #       config.password_cipher = 'AES-128-CBC'  #
  #       config.data_cipher = 'AES-256-CBC'
  #       config.private_key_cipher = config.data_cipher
  #       config.compression_enabled = true
  #       config.compression_level = Zlib::BEST_COMPRESSION
  #     end
  class Configuration
    class << self
      attr_accessor :config

      def configure
        self.config ||= Configuration.new
        yield config if block_given?
      end

      def property(name)
        self.config.send(name)
      end
    end

    attr_accessor :data_cipher, :password_cipher, :private_key_cipher
    attr_accessor :compression_enabled, :compression_level, :password_cache
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shhh-1.6.5 lib/shhh/configuration.rb
shhh-1.6.4 lib/shhh/configuration.rb
shhh-1.6.3 lib/shhh/configuration.rb
shhh-1.6.2 lib/shhh/configuration.rb
shhh-1.6.1 lib/shhh/configuration.rb