Module: TcravitRubyLib::Utility
Overview
Contains random Ruby utility functions that don’t fit anywhere else.
Instance Method Summary collapse
-
#random_alphanumeric(size = 16, pronounceable = false) ⇒ String
Generate random alphanumeric passwords.
Instance Method Details
#random_alphanumeric(size = 16, pronounceable = false) ⇒ String
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.
to 16 characters if not specified. Defaults to false.
42 43 44 45 46 47 48 |
# File 'lib/tcravit_ruby_lib/utility.rb', line 42 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 |