class SimpleEncryption::Encrypter

Public Class Methods

decrypt(message) click to toggle source
# File lib/simple_encryption/encrypter.rb, line 11
def self.decrypt(message)
  raise_error_when_message_is_nil(message)
  cipher.decrypt(message)
end
encrypt(message) click to toggle source
# File lib/simple_encryption/encrypter.rb, line 6
def self.encrypt(message)
  raise_error_when_message_is_nil(message)
  cipher.encrypt(message)
end

Private Class Methods

cipher() click to toggle source
# File lib/simple_encryption/encrypter.rb, line 22
def self.cipher
  SimpleEncryption::Configuration.config.encryption_algorithm
end
raise_error_when_message_is_nil(message) click to toggle source
# File lib/simple_encryption/encrypter.rb, line 18
def self.raise_error_when_message_is_nil(message)
  raise NoMessageError.new("A message must be provided.") unless message
end