Sha256: ac16b60a328572de3529355d8fbac4d3d735c781a3818bed58d4dd8568eafc06
Contents?: true
Size: 533 Bytes
Versions: 10
Compression:
Stored size: 533 Bytes
Contents
# frozen_string_literal: true require 'securerandom' module RakeSecrets module Types class CharacterSet def initialize(character_set, opts = {}) @character_set = character_set @character_count = character_set.length @length = opts[:length] || 32 end def generate (1..@length) .collect { @character_set[random_index] } .join end private def random_index SecureRandom.random_number(@character_count) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems