Sha256: cf8da7737ff7e60d8be668309d013d461590f03c96038ed276d4a7df85b78765

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

require 'securerandom'

module Antrapol
  module ToolRack
    module PasswordUtils
      include Antrapol::ToolRack::ConditionUtils

      def generate_random_password(length = 12)
        length = 12 if is_empty?(length)
        length = length.to_i
        length = 12 if length <= 0

        antropy = ('!'..'~').to_a
        antropy.sort_by { SecureRandom.random_number }.join[0...length]
      end
      alias_method :gen_rand_pass, :generate_random_password
      alias_method :gen_pass, :generate_random_password

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toolrack-0.9.0 lib/toolrack/password_utils.rb