Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DnD generator #2098

Merged
merged 3 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions doc/games/dnd.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Faker::Games::DnD

```ruby
Faker::Games::DnD.species #=> "Dwarf"
Faker::Games::DnD.alignment #=> "Lawful Neutral"

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

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

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

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

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

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

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

Faker::Games::DnD.ranged_weapon #=> "Shortbow"
```
103 changes: 89 additions & 14 deletions lib/faker/games/dnd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,42 @@ class Games
class DnD < Base
class << self
##
# Produces the name of a race from Dungeons and Dragons (PHB).
# Produces the name of an alignment from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.species #=> "Dwarf"
# Faker::Games::DnD.alignment #=> "Lawful Neutral"
#
# @faker.version 2.13.0
def species
fetch('dnd.species')
def alignment
fetch('dnd.alignments')
end

##
# Produces the name of a background from Dungeons and Dragons (PHB).
#
# @return [String]
#
# @example
# Faker::Games::DnD.background #=> "Urchin"
#
# @faker.version 2.13.0
def background
fetch('dnd.backgrounds')
end

##
# Produces the name of a city from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.city #=> "Earthfast"
#
# @faker.version next
def city
fetch('dnd.cities')
end

##
Expand All @@ -31,29 +57,78 @@ def klass
end

##
# Produces the name of a background from Dungeons and Dragons (PHB).
# Produces the name of a language from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.background #=> "Urchin"
# Faker::Games::DnD.language #=> "Gnomish"
#
# @faker.version 2.13.0
def background
fetch('dnd.backgrounds')
# @faker.version next
def language
fetch('dnd.languages')
end

##
# Produces the name of an alignment from Dungeons and Dragons.
# Produces the name of a melee weapon from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.alignment #=> "Lawful Neutral"
# Faker::Games::DnD.melee_weapon #=> "Handaxe"
#
# @faker.version 2.13.0
def alignment
fetch('dnd.alignments')
# @faker.version next
def melee_weapon
fetch('dnd.melee_weapons')
end

##
# Produces the name of a monster from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.monster #=> "Manticore"
#
# @faker.version next
def monster
fetch('dnd.monsters')
end

##
# Produces the name of a race from Dungeons and Dragons (PHB).
#
# @return [String]
#
# @example
# Faker::Games::DnD.races #=> "Dwarf"
#
# @faker.version next
def race
fetch('dnd.races')
end

##
# Produces the name of a ranged weapon from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.ranged_weapon #=> "Shortbow"
#
# @faker.version next
def ranged_weapon
fetch('dnd.ranged_weapons')
end

# This method is deprecated. The implementation will be removed in a near future release.
# Use `DnD.race` instead.
#
# @deprecated Use {#race} instead.
def species
warn '`DnD.species` is deprecated. Use `DnD.race` instead.'

super
end
end
end
Expand Down
Loading