gouf
4/17/2014 - 6:52 AM

ちょっと人にやさしいランダムな命名

ちょっと人にやさしいランダムな命名

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