Class: Faker::Games::DnD

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/games/dnd.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.alignmentString

Produces the name of an alignment from Dungeons and Dragons.

Examples:

Faker::Games::DnD.alignment #=> "Lawful Neutral"

Returns:

  • (String)

Available since:

  • 2.13.0



16
17
18
# File 'lib/faker/games/dnd.rb', line 16

def alignment
  fetch('dnd.alignments')
end

.backgroundString

Produces the name of a background from Dungeons and Dragons (PHB).

Examples:

Faker::Games::DnD.background #=> "Urchin"

Returns:

  • (String)

Available since:

  • 2.13.0



29
30
31
# File 'lib/faker/games/dnd.rb', line 29

def background
  fetch('dnd.backgrounds')
end

.cityString

Produces the name of a city from Dungeons and Dragons.

Examples:

Faker::Games::DnD.city #=> "Earthfast"

Returns:

  • (String)

Available since:

  • 2.14.0



42
43
44
# File 'lib/faker/games/dnd.rb', line 42

def city
  fetch('dnd.cities')
end

.first_nameString

Produces the first name of a character or monster from Dungeons and Dragons.

Examples:

Faker::Games::DnD.name #=> "Eilonwy"

Returns:

  • (String)

Available since:

  • next



55
56
57
# File 'lib/faker/games/dnd.rb', line 55

def first_name
  fetch('dnd.name.first_name')
end

.klassString

Produces the name of a class from Dungeons and Dragons (PHB).

Examples:

Faker::Games::DnD.klass #=> "Warlock"

Returns:

  • (String)

Available since:

  • 2.13.0



68
69
70
# File 'lib/faker/games/dnd.rb', line 68

def klass
  fetch('dnd.klasses')
end

.languageString

Produces the name of a language from Dungeons and Dragons.

Examples:

Faker::Games::DnD.language #=> "Gnomish"

Returns:

  • (String)

Available since:

  • 2.14.0



81
82
83
# File 'lib/faker/games/dnd.rb', line 81

def language
  fetch('dnd.languages')
end

.last_nameString

Produces a last name from Dungeons and Dragons.

Examples:

Faker::Games::DnD.last_name #=> "Leafwhisper"

Returns:

  • (String)

Available since:

  • next



94
95
96
# File 'lib/faker/games/dnd.rb', line 94

def last_name
  fetch('dnd.name.last_name')
end

.melee_weaponString

Produces the name of a melee weapon from Dungeons and Dragons.

Examples:

Faker::Games::DnD.melee_weapon #=> "Handaxe"

Returns:

  • (String)

Available since:

  • 2.14.0



107
108
109
# File 'lib/faker/games/dnd.rb', line 107

def melee_weapon
  fetch('dnd.melee_weapons')
end

.monsterString

Produces the name of a monster from Dungeons and Dragons.

Examples:

Faker::Games::DnD.monster #=> "Manticore"

Returns:

  • (String)

Available since:

  • 2.14.0



120
121
122
# File 'lib/faker/games/dnd.rb', line 120

def monster
  fetch('dnd.monsters')
end

.nameString

Produces a full name from Dungeons and Dragons.

Examples:

Faker::Games::DnD.name #=> "Drakon Blackthorn"

Returns:

  • (String)

Available since:

  • next



133
134
135
# File 'lib/faker/games/dnd.rb', line 133

def name
  "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.last_name')}"
end

.raceString

Produces the name of a race from Dungeons and Dragons (PHB).

Examples:

Faker::Games::DnD.races #=> "Dwarf"

Returns:

  • (String)

Available since:

  • 2.14.0



146
147
148
# File 'lib/faker/games/dnd.rb', line 146

def race
  fetch('dnd.races')
end

.ranged_weaponString

Produces the name of a ranged weapon from Dungeons and Dragons.

Examples:

Faker::Games::DnD.ranged_weapon #=> "Shortbow"

Returns:

  • (String)

Available since:

  • 2.14.0



159
160
161
# File 'lib/faker/games/dnd.rb', line 159

def ranged_weapon
  fetch('dnd.ranged_weapons')
end

.title_nameString

Produces a last name from Dungeons and Dragons.

Examples:

Faker::Games::DnD.title_name #=> "Corvus the Cunning"

Returns:

  • (String)

Available since:

  • next



172
173
174
# File 'lib/faker/games/dnd.rb', line 172

def title_name
  "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.title')}"
end