Skip to content

Instantly share code, notes, and snippets.

@enajski
Created August 28, 2013 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enajski/6364295 to your computer and use it in GitHub Desktop.
Save enajski/6364295 to your computer and use it in GitHub Desktop.
Faker CSV generator, courtesy of @yapee I think.
require 'faker'
modules = [Faker::Name, Faker::Company, Faker::Address, Faker::PhoneNumber, Faker::Internet]
puts modules.map { |x| x.methods(false).map { |y| "#{x.to_s.gsub("Faker::", "")} #{y}"} }.flatten.join(',')
data = (0...ARGV[0].to_i).map do
modules.map { |x| x.methods(false).map { |y| x.send(y) if x.method(y).arity < 1} }.flatten.join(',')
end
puts data.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment