Project

strgen

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby arbitrary string generator
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
>= 0
~> 10.0
>= 0
 Project Readme

Strgen Build Status

An arbitrary Ruby string generator

Usage

# Default string 12 chars long
Strgen.generate

# Customised string
Strgen.generate do |c|
  c.length = 30
  c.symbols = false
  c.repeat = false
end
Options

Include these in the config block when generating the string (see above)

  • numbers - Numbers 0-9
  • symbols - The following set [! @ # $ % ^ & ( ) { } [ ] - _ < > ?]
  • lowercase - The lowercase alphabet
  • uppercase - The uppercase alphabet
  • alpha - A combination of lowercase and uppercase letters.
  • alphanum - A combination of the alpha set and numbers
  • length - The length of the result string
  • repeat - Whether repeated characters are allowed
  • exclude - a character array containing individual letters to exclude

Example

Give me a 25 letter string containing the set of all uppercase letters excluding the letters A and B.

Strgen.generate do |c|
  c.lowercase = false
  c.numbers = false
  c.symbols = false
  c.length = 25
  c.exclude = %w(A B)
end

=> "WUVWREFYEOCCKOHPQCJDJTEZC"
=> "ZKCTKPLXNMFWIZWHCRVUHLHNZ"
=> "FQQDNQKZLVRJIQNFIJHKZKWSO"

Contributing

  1. Fork it ( https://github.com/[my-github-username]/strgen/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request