Sha256: fc5111d3c84871a8d428cd8f25d9eb8f4edf42c5c71b6e21624e92c190be5841
Contents?: true
Size: 721 Bytes
Versions: 2
Compression:
Stored size: 721 Bytes
Contents
module NameGen class RandGenerator CONS = %w(q w r t p s d f g h j k l z x c v b n m) VOWELS = %w(e y u i o a) OPTIONS = [:con1_vow1, :con1, :con1_vow2, :vow1] def initialize end def get_name(elements) result_name = [] elements.times do result_name << get_syllable end result_name.join.capitalize end private def get_syllable case OPTIONS.sample when :con1_vow1 [].push(CONS.sample).push(VOWELS.sample).shuffle.join when :con1_vow2 [].push(CONS.sample).push(VOWELS.sample).push(VOWELS.sample).shuffle.join when :con1 CONS.sample when :vow1 VOWELS.sample end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
name_gen-0.3.0 | lib/name_gen/rand_generator.rb |
name_gen-0.2.1 | lib/name_gen/rand_generator.rb |