lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-3.1.0 vs lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-3.2

- old
+ new

@@ -36,9 +36,14 @@ raise "Call SymmetricEncryption.load! or SymmetricEncryption.cipher= prior to encrypting or decrypting data" unless @@cipher return @@cipher if version.nil? || (@@cipher.version == version) secondary_ciphers.find {|c| c.version == version} || (@@cipher if version == 0) end + # Returns whether a primary cipher has been set + def self.cipher? + !@@cipher.nil? + end + # Set the Secondary Symmetric Ciphers Array to be used def self.secondary_ciphers=(secondary_ciphers) raise "secondary_ciphers must be a collection" unless secondary_ciphers.respond_to? :each secondary_ciphers.each do |cipher| raise "secondary_ciphers can only consist of SymmetricEncryption::Ciphers" unless cipher.respond_to?(:encrypt) && cipher.respond_to?(:decrypt) \ No newline at end of file