RGN short for Random generated name, is a ruby gem to allows users to automate random strings in their ruby apps.
Add this line to your application's Gemfile:
gem 'rgn'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install rgn
If you're just developing a non-rails app in ruby, then just import the following code inside your file: require 'rgn'
- Input
require 'rgn'
at the beginning of the ruby file. - Input
include Rgn
after the require statement. - Next, declare a variable to contain generator function. For example,
randomStr = generateName
Then enter:puts #{randomStr} or puts randomStr
to generate random string.