Class: Izokatu::Decrypter Abstract

Inherits:
Object
  • Object
show all
Extended by:
Callable
Includes:
Contracts
Defined in:
lib/izokatu/decrypter.rb

Overview

This class is abstract.

Subclasses are containing implementation of #decrypt_data!

Abstract class for decrypters

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callable

call

Constructor Details

#initialize(encrypted_data:) ⇒ Decrypter

Initializing option for decryption

Parameters:

Since:

  • 0.1.0



25
26
27
# File 'lib/izokatu/decrypter.rb', line 25

def initialize(encrypted_data:)
  import_encrypted_data!(encrypted_data)
end

Instance Attribute Details

#decrypted_dataHash (readonly)

Returns decrypted data for export.

Returns:

  • (Hash)

    decrypted data for export



17
18
19
# File 'lib/izokatu/decrypter.rb', line 17

def decrypted_data
  @decrypted_data
end

#decrypterObject (readonly)

Returns decrypter instance.

Returns:

  • decrypter instance



13
14
15
# File 'lib/izokatu/decrypter.rb', line 13

def decrypter
  @decrypter
end

#encrypted_dataString (readonly)

Returns encrypted data for decryption.

Returns:

  • (String)

    encrypted data for decryption



15
16
17
# File 'lib/izokatu/decrypter.rb', line 15

def encrypted_data
  @encrypted_data
end

Instance Method Details

#decrypt_data!Object (private)

Decrypting data

Raises:

  • RuntimeError

Since:

  • 0.1.0



58
59
60
# File 'lib/izokatu/decrypter.rb', line 58

def decrypt_data!
  raise 'Not implemented!'
end

#import_encrypted_data!(encrypted_data) ⇒ String

Importing encrypted data from param

Parameters:

Returns:

  • (String)

    (#encrypted_data)

Since:

  • 0.1.0



37
38
39
# File 'lib/izokatu/decrypter.rb', line 37

def import_encrypted_data!(encrypted_data)
  @encrypted_data = encrypted_data
end

#performHash

Performing data decryption

Returns:

  • (Hash)

    decrypted data

Since:

  • 0.1.0



47
48
49
# File 'lib/izokatu/decrypter.rb', line 47

def perform
  decrypt_data!
end