Module: Encryption::String

Defined in:
lib/helpers/string.rb

Instance Method Summary collapse

Instance Method Details

#decrypt(options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/helpers/string.rb', line 12

def decrypt(options = {})
  string = self
  string = Base64.decode64(self) if options[:encode] or options[:encoded]
  encryptor(options).decrypt string
end

#decrypt!(options = {}) ⇒ Object



22
23
24
# File 'lib/helpers/string.rb', line 22

def decrypt!(options = {})
  replace decrypt(options)
end

#encrypt(options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/helpers/string.rb', line 6

def encrypt(options = {})
  string = encryptor(options).encrypt self
  string = Base64.encode64(string) if options[:encode]
  string
end

#encrypt!(options = {}) ⇒ Object



18
19
20
# File 'lib/helpers/string.rb', line 18

def encrypt!(options = {})
  replace encrypt(options)
end