Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Faker CSV generator, courtesy of @yapee I think.
require 'faker'
modules = [Faker::Name, Faker::Company, Faker::Address, Faker::PhoneNumber, Faker::Internet]
puts { |x| x.methods(false).map { |y| "#{x.to_s.gsub("Faker::", "")} #{y}"} }.flatten.join(',')
data = (0...ARGV[0].to_i).map do { |x| x.methods(false).map { |y| x.send(y) if x.method(y).arity < 1} }.flatten.join(',')
puts data.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment