spec/support/encryptors.rb in crypt_keeper-0.14.0.pre vs spec/support/encryptors.rb in crypt_keeper-0.15.0.pre

- old
+ new

@@ -1,31 +1,41 @@ -# A fake class that does no encryption module CryptKeeper module Provider + # A fake class that does no encryption class FakeEncryptor - include CryptKeeper::Helper::Serializer + def initialize(*args) + end + def encrypt(value) + value + end + + def decrypt(value) + value + end + end + + class SearchEncryptor def initialize(*args) end def encrypt(value) value end def decrypt(value) value end + + def search(records, field, criteria) + records.select { |record| record[field] == criteria } + end end - end -end -# This class embeds the passphrase in the beginning of the string -# and then reverses the 'plaintext' -module CryptKeeper - module Provider - class Encryptor - include CryptKeeper::Helper::Serializer + # This class embeds the passphrase in the beginning of the string + # and then reverses the 'plaintext' + class Encryptor def initialize(options = {}) @passphrase = options[:passphrase] end def encrypt(data)