lib/sym/crypt/configuration.rb in sym-crypt-1.1.1 vs lib/sym/crypt/configuration.rb in sym-crypt-1.2.0
- old
+ new
@@ -1,7 +1,8 @@
require 'singleton'
require 'sym/configurable'
+require 'sym/crypt/configuration'
require 'ostruct'
module Sym
module Crypt
# This class encapsulates application configuration, and exports
# a familiar method +#configure+ for defining configuration in a
@@ -22,29 +23,25 @@
# config.private_key_cipher = config.data_cipher
# config.compression_enabled = true
# config.compression_level = Zlib::BEST_COMPRESSION
# end
- class Configuration < OpenStruct
+ class Configuration
+ attr_accessor :password_cipher,
+ :data_cipher,
+ :private_key_cipher,
+ :compression_enabled,
+ :compression_level
+ def initialize
+ self.password_cipher = 'AES-128-CBC'
+ self.data_cipher = 'AES-256-CBC'
+ self.private_key_cipher = data_cipher
+ self.compression_enabled = true
+ self.compression_level = Zlib::BEST_COMPRESSION
+ end
+
include Sym::Configurable
- class << self
- def defaults!
- configure(&default_proc)
- end
-
- private
-
- def default_proc
- ->(config) do
- 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
- end
- end
end
end
end