markbates / mack-more

All the extra stuff you could want for the Mack Framework.

mack-more / mack-encryption / lib / mack-encryption / string.rb
100644 21 lines (18 sloc) 0.401 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class String
  
  # Maps to Kernel _encrypt
  #
  # Examples:
  # "Hello World".encrypt
  # "Hello World".encrypt(:my_crypt)
  def encrypt(worker = :default)
    _encrypt(self, worker)
  end
  
  # Maps to Kernel _decrypt
  #
  # Examples:
  # some_encrypted_string.decrypt
  # some_encrypted_string.decrypt(:my_crypt)
  def decrypt(worker = :default)
    _decrypt(self, worker)
  end
  
end