Class: Complicode::Generators::PartialKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/complicode/generators/partial_keys.rb

Class Method Summary collapse

Class Method Details

.call(key, verification_digits) ⇒ Array<String>


9
10
11
12
13
14
# File 'lib/complicode/generators/partial_keys.rb', line 9

def self.call(key, verification_digits)
  partial_key_sizes = verification_digits.split("").map { |digit| digit.to_i + 1 }
  partial_key_sizes.map do |index|
    PartialKey.new(value: key.slice!(0...index))
  end
end