Module: Faker::Game::Character

Defined in:
lib/faker/game/character.rb

Constant Summary collapse

NEUTRAL_PREFIXES =
%w(byr dy mi beo tyr)
NEUTRAL_POSTFIXES =
%w(dren bor dun mar del lad ar gren grad gard born bar bel wren rend mel dar den ful ren)
NEUTRAL_ANIMALS =
%w(wolf dragon bear beast)
NEUTRAL_NATURE =
%w(cliff storm wind sand earth)
NEUTRAL_NOUNS =
CharacterTitle::NEUTRAL_PROFESSIONS + NEUTRAL_NATURE + NEUTRAL_ANIMALS

Class Method Summary collapse

Class Method Details

.first_nameObject



11
12
13
# File 'lib/faker/game/character.rb', line 11

def first_name
  (NEUTRAL_PREFIXES.sample + NEUTRAL_POSTFIXES.sample)
end

.nameObject



15
16
17
# File 'lib/faker/game/character.rb', line 15

def name
  "#{first_name} #{surname}".titleize
end

.name_with_titleObject



31
32
33
# File 'lib/faker/game/character.rb', line 31

def name_with_title
  "#{name}#{separator}#{CharacterTitle.send %w(evil neutral good).sample}"
end

.objectObject



19
20
21
# File 'lib/faker/game/character.rb', line 19

def object
  NEUTRAL_NOUNS.sample + (NEUTRAL_NOUNS + [nil]).sample.to_s
end

.prefixObject



23
24
25
# File 'lib/faker/game/character.rb', line 23

def prefix
  (NEUTRAL_PREFIXES + [nil]).sample.to_s
end

.surnameObject



27
28
29
# File 'lib/faker/game/character.rb', line 27

def surname
  (prefix + object + NEUTRAL_POSTFIXES.sample)
end