Skip to content

Commit

Permalink
Add Faker::Fantasy::Tolkien (faker-ruby#2152)
Browse files Browse the repository at this point in the history
* 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
Matt Kelly authored and droznyk committed Oct 23, 2020
1 parent fc9bd02 commit ac813b8
Show file tree
Hide file tree
Showing 8 changed files with 2,557 additions and 36 deletions.
67 changes: 67 additions & 0 deletions lib/faker/fantasy/tolkien.rb
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
8 changes: 4 additions & 4 deletions lib/faker/movies/hobbit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class << self
#
# @faker.version 1.8.0
def character
fetch('hobbit.character')
fetch('tolkien.hobbit.character')
end

##
Expand All @@ -27,7 +27,7 @@ def character
#
# @faker.version 1.8.0
def thorins_company
fetch('hobbit.thorins_company')
fetch('tolkien.hobbit.thorins_company')
end

##
Expand All @@ -41,7 +41,7 @@ def thorins_company
#
# @faker.version 1.8.0
def quote
fetch('hobbit.quote')
fetch('tolkien.hobbit.quote')
end

##
Expand All @@ -54,7 +54,7 @@ def quote
#
# @faker.version 1.8.0
def location
fetch('hobbit.location')
fetch('tolkien.hobbit.location')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/faker/movies/lord_of_the_rings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class << self
#
# @faker.version 1.7.0
def character
fetch('lord_of_the_rings.characters')
fetch('tolkien.lord_of_the_rings.characters')
end

##
Expand All @@ -27,7 +27,7 @@ def character
#
# @faker.version 1.7.0
def location
fetch('lord_of_the_rings.locations')
fetch('tolkien.lord_of_the_rings.locations')
end

##
Expand All @@ -41,7 +41,7 @@ def location
#
# @faker.version 1.9.0
def quote
fetch('lord_of_the_rings.quotes')
fetch('tolkien.lord_of_the_rings.quotes')
end
end
end
Expand Down
19 changes: 0 additions & 19 deletions lib/locales/en/hobbit.yml

This file was deleted.

6 changes: 0 additions & 6 deletions lib/locales/en/lord_of_the_rings.yml

This file was deleted.

Loading

0 comments on commit ac813b8

Please sign in to comment.