Skip to content

Instantly share code, notes, and snippets.

@gouf
Last active July 13, 2016 14:28
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 gouf/10958904 to your computer and use it in GitHub Desktop.
Save gouf/10958904 to your computer and use it in GitHub Desktop.
ちょっと人にやさしいランダムな命名
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