0.0
No commit activity in last 3 years
No release in over 3 years
This gem helps you generate random string of various "types" - a random email, a random date, a random Twitter handle, etc. Or just a random string.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

RandomStrings

This gem helps you generate random string of various "types" - a random email, a random date, a random Twitter handle, etc. Or just a random string or number.

It's a great gem to use when creating seeds for database applications - like in a Rails seeds.rb file, for example. (hint, hint.)

Installation

Add this line to your application's Gemfile:

gem 'random_strings'

And then execute:

$ bundle

Or install it yourself as:

$ gem install random_strings

Usage

Initialize like this:

@my_gen = RandomStrings::Generator.new do |config|
  config.default_string_length=7
  config.default_number_length=6
  config.tld_list=['.net', '.my', '.ly']
end

Here are a few functions you can use:

@generator=RandomStrings::Generator.new
a_zip=@generator.random_zip # Will look like, 40072
an_email=@generator.random_email # Will look like, uuyhWAAJne@uuqVGjEaka.net

These are composed from the following basic functions:

RandomStrings::Generator#random_digits
RandomStrings::Generator#random_string

Contributing

  1. Fork it
  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 new Pull Request