Thursday, September 20, 2007
random_data gem released
I just released my first Ruby gem. I have a library of functions that I use for generating realistic data so I can have more meaningful examples to work with during development. So I used the newgem generator and hoe to package it all into a gem called random_data.It provides a Random singleton class with a series of methods for generating random test data including names, mailing addresses, dates, phone numbers, e-mail addresses, and text. This lets you quickly mock up realistic looking data for informal testing.
Instead of:
>> foo.name = "John Doe"You get:>> foo.name = " "
>> foo.name
=> "Miriam R. Xichuan"
The gem also includes code for phone numbers, e-mail addresses, physical addresses, and (primitive) text generation.
You can install it via:
For more details and full documentation, visit the rubyforge site.
sudo gem install random_data


3 Comments:
How does one require your gem? I have tried
require 'random_data'
which produced the following error message:
irb(main):002:0> require 'random_data'
LoadError: no such file to load -- random_data
from (irb):2:in `require'
from (irb):2
OK, I resolved the issue. I needed to do the following:
require 'rubygems'
require 'random_data'
glad you were able to get it working! In Ruby 1.9 I believe rubygems is standard, so you won't have to require it separately.
Post a Comment
Links to this post:
Create a Link
<< Home