Class: MassEncryption::Encryptor

Inherits:
Object
  • Object
show all
Defined in:
lib/mass_encryption/encryptor.rb

Constant Summary collapse

DEFAULT_BATCH_SIZE =
1000

Instance Method Summary collapse

Constructor Details

#initialize(from_id: nil, only: nil, except: nil, batch_size: DEFAULT_BATCH_SIZE, tracks_count: nil, silent: true) ⇒ Encryptor

Returns a new instance of Encryptor.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mass_encryption/encryptor.rb', line 6

def initialize(from_id: nil, only: nil, except: nil, batch_size: DEFAULT_BATCH_SIZE, tracks_count: nil, silent: true)
  only = Array(only || all_encryptable_classes)
  except = Array(except)

  @from_id = from_id
  @encryptable_classes = only - except
  @batch_size = batch_size
  @silent = silent
  @tracks_count = tracks_count

  logger.info info_message unless silent
end

Instance Method Details

#encrypt_all_laterObject



19
20
21
# File 'lib/mass_encryption/encryptor.rb', line 19

def encrypt_all_later
  encryptable_classes.each { |klass| enqueue_encryption_jobs_for(klass) }
end