Module: EasyEncryption::InstanceMethods
- Defined in:
- lib/easy_encryption/instance_methods.rb
Instance Method Summary collapse
-
#cipher_key=(cipher_key) ⇒ Object
setter to change the cipher key on an instance of String.
-
#decrypt(cipher_key = nil) ⇒ Object
decrypts a string.
-
#encrypt(cipher_key = nil) ⇒ Object
encrypts a string.
Instance Method Details
#cipher_key=(cipher_key) ⇒ Object
setter to change the cipher key on an instance of String
18 19 20 |
# File 'lib/easy_encryption/instance_methods.rb', line 18 def cipher_key=(cipher_key) @cipher_key = cipher_key end |
#decrypt(cipher_key = nil) ⇒ Object
decrypts a string. ex: “string”.decrypt
12 13 14 15 |
# File 'lib/easy_encryption/instance_methods.rb', line 12 def decrypt(cipher_key=nil) @cipher_key = cipher_key if cipher_key cipher.decrypt self end |
#encrypt(cipher_key = nil) ⇒ Object
encrypts a string. ex: “string”.encrypt
6 7 8 9 |
# File 'lib/easy_encryption/instance_methods.rb', line 6 def encrypt(cipher_key=nil) @cipher_key = cipher_key if cipher_key cipher.encrypt self end |