forked from faker-ruby/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Faker::Fantasy::Tolkien (faker-ruby#2152)
* Combine lotr and hobbit into tolkien .yml * Add tolkien characters * Restore hobbit and lotr movie yamls * Fix generator to use new legendarium class * Combine hobbit and lotr yml into legendarium yml * Add indentation to yaml array list items Also, do not wrap lines at 81 chars (Pysch default) * Point tolkien movies to default lengendarium yml * Remove silly comment * Use consistent quotations. Unbreak lines. * Alias 'movie' classes. Point to new yaml file name * Add tests * Fix formatting and documentation * Re-namespace to fantasy/tolkien
- Loading branch information
Showing
8 changed files
with
2,557 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# frozen_string_literal: true | ||
|
||
module Faker | ||
class Fantasy | ||
class Tolkien < Base | ||
flexible :tolkien | ||
|
||
class << self | ||
## | ||
# Produces a character from Tolkien's legendarium | ||
# | ||
# @return [String] | ||
# | ||
# @example | ||
# Faker::Fantasy::Tolkien.character | ||
# #=> "Goldberry" | ||
# | ||
# @faker.version next | ||
def character | ||
fetch('tolkien.characters') | ||
end | ||
|
||
## | ||
# Produces a location from Tolkien's legendarium | ||
# | ||
# @return [String] | ||
# | ||
# @example | ||
# Faker::Fantasy::Tolkien.location | ||
# #=> "Helm's Deep" | ||
# | ||
# @faker.version next | ||
def location | ||
fetch('tolkien.locations') | ||
end | ||
|
||
## | ||
# Produces a race from Tolkien's legendarium | ||
# | ||
# @return [String] | ||
# | ||
# @example | ||
# Faker::Fantasy::Tolkien.race | ||
# #=> "Uruk-hai" | ||
# | ||
# @faker.version next | ||
def race | ||
fetch('tolkien.races') | ||
end | ||
|
||
## | ||
# Produces the name of a poem from Tolkien's legendarium | ||
# | ||
# @return [String] | ||
# | ||
# @example | ||
# Faker::Fantasy::Tolkien.poem | ||
# #=> "Chip the glasses and crack the plates" | ||
# | ||
# @faker.version next | ||
def poem | ||
fetch('tolkien.poems') | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.