lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-4.1.0.beta1 vs lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-4.1.0
- old
+ new
@@ -53,10 +53,11 @@
'Call SymmetricEncryption.load! or SymmetricEncryption.cipher= prior to encrypting or decrypting data'
)
end
return @@cipher if version.nil? || (@@cipher.version == version)
+
secondary_ciphers.find { |c| c.version == version } || (@@cipher if version.zero?)
end
# Returns whether a primary cipher has been set
def self.cipher?
@@ -262,10 +263,10 @@
# # Use cipher version 0 if the encoded string ends with "\n" otherwise
# # use the current default cipher
# encoded_str.end_with?("\n") ? SymmetricEncryption.cipher(0) : SymmetricEncryption.cipher
# end
def self.select_cipher(&block)
- @@select_cipher = block ? block : nil
+ @@select_cipher = block || nil
end
# Load the Encryption Configuration from a YAML file
# file_name:
# Name of file to read.