Skip to content

Instantly share code, notes, and snippets.

@gouf
Last active Jul 13, 2016
Embed
What would you like to do?
ちょっと人にやさしいランダムな命名
require 'randexp'
require 'faker'
require 'forgery'
I18n.enforce_available_locales = true
I18n.default_locale = :en
class Randgen
def self.rand_name(options = {})
/#{Forgery::Basic.color}-#{Faker::Name.first_name}-\d{4}/.gen.downcase
end
end
8.times do
p /[:rand_name:]/.gen
end
=begin
"fuscia-kyleigh-8861"
"green-mallory-9411"
"goldenrod-estella-9444"
"pink-abby-7976"
"red-rogers-5788"
"mauv-dell-1808"
"blue-ron-0976"
"pink-eileen-0828"
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment