Class: Underlock::EncryptedEntity
- Inherits:
-
Object
- Object
- Underlock::EncryptedEntity
- Defined in:
- lib/underlock/encrypted_entity.rb
Instance Attribute Summary collapse
-
#encrypted_file ⇒ Object
Returns the value of attribute encrypted_file.
-
#iv ⇒ Object
Returns the value of attribute iv.
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #decrypt ⇒ Object
-
#initialize(value: nil, encrypted_file: nil, key:, iv:) ⇒ EncryptedEntity
constructor
A new instance of EncryptedEntity.
- #inspect ⇒ Object
Constructor Details
#initialize(value: nil, encrypted_file: nil, key:, iv:) ⇒ EncryptedEntity
Returns a new instance of EncryptedEntity.
5 6 7 8 9 10 |
# File 'lib/underlock/encrypted_entity.rb', line 5 def initialize(value: nil, encrypted_file: nil, key:, iv:) @encrypted_file = encrypted_file @value = value @key = key @iv = iv end |
Instance Attribute Details
#encrypted_file ⇒ Object
Returns the value of attribute encrypted_file.
4 5 6 |
# File 'lib/underlock/encrypted_entity.rb', line 4 def encrypted_file @encrypted_file end |
#iv ⇒ Object
Returns the value of attribute iv.
4 5 6 |
# File 'lib/underlock/encrypted_entity.rb', line 4 def iv @iv end |
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/underlock/encrypted_entity.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/underlock/encrypted_entity.rb', line 4 def value @value end |
Instance Method Details
#decrypt ⇒ Object
12 13 14 15 |
# File 'lib/underlock/encrypted_entity.rb', line 12 def decrypt return Encryptor.new.decrypt(self) if value return FileEncryptor.new.decrypt(self) if encrypted_file end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/underlock/encrypted_entity.rb', line 17 def inspect self.to_s end |