Module: Encryption::String
- Defined in:
- lib/helpers/string.rb
Instance Method Summary collapse
- #decrypt(options = {}) ⇒ Object
- #decrypt!(options = {}) ⇒ Object
- #encrypt(options = {}) ⇒ Object
- #encrypt!(options = {}) ⇒ Object
Instance Method Details
#decrypt(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/helpers/string.rb', line 12 def decrypt( = {}) string = self string = Base64.decode64(self) if [:encode] or [:encoded] encryptor().decrypt string end |
#decrypt!(options = {}) ⇒ Object
22 23 24 |
# File 'lib/helpers/string.rb', line 22 def decrypt!( = {}) replace decrypt() end |
#encrypt(options = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/helpers/string.rb', line 6 def encrypt( = {}) string = encryptor().encrypt self string = Base64.encode64(string) if [:encode] string end |
#encrypt!(options = {}) ⇒ Object
18 19 20 |
# File 'lib/helpers/string.rb', line 18 def encrypt!( = {}) replace encrypt() end |