Module: XKPassword

Defined in:
lib/xkpassword.rb,
lib/xkpassword/version.rb

Defined Under Namespace

Classes: Generator, Store, Words

Constant Summary collapse

VERSION =
'0.2.3'

Class Method Summary collapse

Class Method Details

.generate(options = nil) ⇒ Object

Generates a random password by intializing a ‘XKPassword::Generator` instance. This accepts argumennts identcal to the above class.

If you are to generate multiple passwords (batch process lets say), you might as well directly use the ‘XKPassword::Generator` class as it will be faster since it will only need to load the dictionary once.

Parameters:

  • options (Hash) (defaults to: nil)

    The options to populate a generator

Options Hash (options):

  • :words (Integer)

    The number of words to include in the generated password

  • :separator (String)

    The separator symbol to use joining words used in password

  • :min_length (Integer)

    The minimum length of a word to be used in the process

  • :max_length (Integer)

    The maximum length of a word to be used in the process



15
16
17
18
# File 'lib/xkpassword.rb', line 15

def self.generate(options = nil)
  generator = XKPassword::Generator.new
  generator.generate(options)
end