lib/encrypted_strings/extensions/string.rb in encrypted_strings-0.1.0 vs lib/encrypted_strings/extensions/string.rb in encrypted_strings-0.1.1
- old
+ new
@@ -58,11 +58,11 @@
# instead of a different one.
#
# == Example
#
# password = 'shhhh'
- # password.encrypt!(:symmetric, :key => 'my_key') # => "jDACXI5hMPI=\n"
+ # password.encrypt!(:symmetric, :password => 'my_key') # => "jDACXI5hMPI=\n"
# password # => "jDACXI5hMPI=\n"
def encrypt!(*args)
encrypted_string = encrypt(*args)
self.encryptor = encrypted_string.encryptor
@@ -87,11 +87,11 @@
# algorithm is specified when encrypting a string.
#
# == Example
#
# password = "jDACXI5hMPI=\n"
- # password.decrypt(:symmetric, :key => 'my_key') # => "shhhh"
+ # password.decrypt(:symmetric, :password => 'my_key') # => "shhhh"
def decrypt(*args)
raise ArgumentError, "An encryption algorithm must be specified since we can't figure it out" if args.empty? && !@encryptor
encryptor = args.any? ? encryptor_from_args(*args) : (@encryptor || encryptor_from_args(*args))
encrypted_string = encryptor.decrypt(self)
@@ -105,10 +105,10 @@
# instead of a different one.
#
# For example,
#
# password = "jDACXI5hMPI=\n"
- # password.decrypt!(:symmetric, :key => 'my_key') # => "shhhh"
+ # password.decrypt!(:symmetric, :password => 'my_key') # => "shhhh"
# password # => "shhhh"
def decrypt!(*args)
value = replace(decrypt(*args))
self.encryptor = nil
value