Class: Underlock::Base

Inherits:
Object
  • Object
show all
Extended by:
Dry::Configurable
Defined in:
lib/underlock/base.rb

Class Method Summary collapse

Class Method Details

.decrypt(encrypted_entity) ⇒ Object



22
23
24
# File 'lib/underlock/base.rb', line 22

def decrypt(encrypted_entity)
  encrypted_entity.decrypt
end

.encrypt(unencrypted_value) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/underlock/base.rb', line 12

def encrypt(unencrypted_value)
  if Pathname.new(unencrypted_value).exist?
    unencrypted_value = File.new(unencrypted_value)
  end
  case unencrypted_value
    when File   then FileEncryptor.new.encrypt(unencrypted_value)
    when String then Encryptor.new.encrypt(unencrypted_value)
  end
end