Module: Encryptor::String
- Defined in:
- lib/encryptor/string.rb
Overview
Adds encrypt
and decrypt
methods to strings
Instance Method Summary collapse
-
#decrypt(options = {}) ⇒ Object
Returns a new string containing the decrypted version of itself.
-
#decrypt!(options = {}) ⇒ Object
Replaces the contents of a string with the decrypted version of itself.
-
#encrypt(options = {}) ⇒ Object
Returns a new string containing the encrypted version of itself.
-
#encrypt!(options = {}) ⇒ Object
Replaces the contents of a string with the encrypted version of itself.
Instance Method Details
#decrypt(options = {}) ⇒ Object
Returns a new string containing the decrypted version of itself
15 16 17 |
# File 'lib/encryptor/string.rb', line 15 def decrypt( = {}) Encryptor.decrypt(.merge(value: self)) end |
#decrypt!(options = {}) ⇒ Object
Replaces the contents of a string with the decrypted version of itself
20 21 22 |
# File 'lib/encryptor/string.rb', line 20 def decrypt!( = {}) replace decrypt() end |
#encrypt(options = {}) ⇒ Object
Returns a new string containing the encrypted version of itself
5 6 7 |
# File 'lib/encryptor/string.rb', line 5 def encrypt( = {}) Encryptor.encrypt(.merge(value: self)) end |
#encrypt!(options = {}) ⇒ Object
Replaces the contents of a string with the encrypted version of itself
10 11 12 |
# File 'lib/encryptor/string.rb', line 10 def encrypt!( ={}) replace encrypt() end |