lib/tcravit_ruby_lib/utility.rb
##
# Generate random alphanumeric passwords.
#
# Previously this method generated passwords by shuffling characters
# in an array. It's now  just a wrapper for the +simple-password-gen+
# gem.
#
# @param size [Integer] The length of the password to generate. Defaults
# to 16 characters if not specified.
# @param pronounceable [Boolean] True to generate pronounceable passwords.
# Defaults to false.
# @return [String] The generated password.
Generate random alphanumeric passwords.
Previously this method generated passwords by shuffling characters
in an array. It's now  just a wrapper for the +simple-password-gen+
gem.
Generate random alphanumeric passwords . Previously this method generated passwords by shuffling characters in an array . It ' s now just a wrapper for the + simple - password - gen + gem .
def random_alphanumeric(size=16, pronounceable=false)
      if pronounceable then
        return Password.pronounceable(size*2)[0..(size-1)]
      else
        return Password.random(size*2)[0..(size-1)]
      end
    end
def random_alphanumeric ( size = 16 , pronounceable = false ) if pronounceable then return Password . pronounceable ( size * 2 ) [ 0 .. ( size - 1 ) ] else return Password . random ( size * 2 ) [ 0 .. ( size - 1 ) ] end end
Generate random alphanumeric passwords.
Generate random alphanumeric passwords .
The generated password.
The generated password .
String
size
The length of the password to generate. Defaults to 16 characters if not specified.
The length of the password to generate . Defaults to 16 characters if not specified .
pronounceable
True to generate pronounceable passwords. Defaults to false.
True to generate pronounceable passwords . Defaults to false .