Skip to content

Instantly share code, notes, and snippets.

Embed
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 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
You can’t perform that action at this time.