Sha256: 5fcf7c123ab2b6a95ccf01d0c9244a95282518a6ff36d7b948a5215950a79653

Contents?: true

Size: 360 Bytes

Versions: 1

Compression:

Stored size: 360 Bytes

Contents

# frozen_string_literal: true

module CpfCnpj
  class Generator
    NUMBERS = Array(0..9).freeze

    def self.generate(size, verifier_digit_generator)
      numbers = Array.new(size) { NUMBERS.sample }
      numbers << verifier_digit_generator.generate(numbers)
      numbers << verifier_digit_generator.generate(numbers)
      numbers.join
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cpf_cnpj-0.6.0 lib/cpf_cnpj/generator.rb