lib/lockbox/encryptor.rb in lockbox-0.3.0 vs lib/lockbox/encryptor.rb in lockbox-0.3.1

- old
+ new

@@ -3,12 +3,12 @@ def initialize(**options) options = Lockbox.default_options.merge(options) previous_versions = options.delete(:previous_versions) @boxes = - [Box.new(options)] + - Array(previous_versions).map { |v| Box.new({key: options[:key]}.merge(v)) } + [Box.new(**options)] + + Array(previous_versions).map { |v| Box.new(key: options[:key], **v) } end def encrypt(message, **options) message = check_string(message, "message") @boxes.first.encrypt(message, **options) @@ -72,9 +72,10 @@ source.original_filename elsif source.respond_to?(:path) File.basename(source.path) end target.content_type = source.content_type if source.respond_to?(:content_type) + target.set_encoding(source.external_encoding) if source.respond_to?(:external_encoding) end # legacy for attr_encrypted def self.encrypt(options) box(options).encrypt(options[:value])