module RandomNameGenerator
RandomNameGenerator:
Examples
rng = RandomNameGenerator::Generator.new(RandomNameGenerator::GOBLIN) puts rng.compose(3)
By default RandomNameGenerator
uses the Fantasy syllable file and creates a name with between 2 and 5 syllables.
rng = RandomNameGenerator::Generator.new puts rng.compose
:reek: TooManyConstants :reek: TooManyInstanceVariables :reek: TooManyStatements
Constants
- CURSE
Experimental
- ELVEN
- ELVEN_RU
- FANTASY
- FANTASY_RU
- GOBLIN
- GOBLIN_RU
- ROMAN
- ROMAN_RU
- VERSION
Public Class Methods
flip_mode()
click to toggle source
Static factory method that instantiates a RandomNameGenerator
in a random language.
# File lib/random_name_generator.rb, line 38 def self.flip_mode langs = [RandomNameGenerator::FANTASY, RandomNameGenerator::ELVEN, RandomNameGenerator::GOBLIN, RandomNameGenerator::ROMAN] Generator.new(langs.sample) end
flip_mode_cyrillic()
click to toggle source
Static factory method that instantiates a RandomNameGenerator
in a random Cyrillic based language.
# File lib/random_name_generator.rb, line 48 def self.flip_mode_cyrillic langs = [RandomNameGenerator::FANTASY_RU, RandomNameGenerator::ELVEN_RU, RandomNameGenerator::GOBLIN_RU, RandomNameGenerator::ROMAN_RU] Generator.new(langs.sample) end
new(language = RandomNameGenerator::FANTASY, random: Random.new)
click to toggle source
Static factory method for the Generator
class.
# File lib/random_name_generator.rb, line 61 def self.new(language = RandomNameGenerator::FANTASY, random: Random.new) Generator.new(language, random: random) end
pick_number_of_syllables(random: Random.new)
click to toggle source
# File lib/random_name_generator.rb, line 56 def self.pick_number_of_syllables(random: Random.new) [2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5].sample(random: random) end