Sha256: 6d8e50555c74b690cc398246213b7a2894b99da645c272b0649ad09800196217

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

module Encryptor
  # Adds <tt>encrypt</tt> and <tt>decrypt</tt> methods to strings
  module String
    # Returns a new string containing the encrypted version of itself
    def encrypt(options = {})
      Encryptor.encrypt(options.merge(value: self))
    end

    # Replaces the contents of a string with the encrypted version of itself
    def encrypt!(options ={})
      replace encrypt(options)
    end

    # Returns a new string containing the decrypted version of itself
    def decrypt(options = {})
      Encryptor.decrypt(options.merge(value: self))
    end

    # Replaces the contents of a string with the decrypted version of itself
    def decrypt!(options = {})
      replace decrypt(options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
encryptor-3.0.0 lib/encryptor/string.rb
encryptor-2.0.0 lib/encryptor/string.rb