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

Add more miscellaneous YARD docs #1756

Merged
merged 14 commits into from Sep 20, 2019
53 changes: 48 additions & 5 deletions lib/faker/default/nation.rb
Expand Up @@ -4,27 +4,70 @@ module Faker
class Nation < Base
flexible :nation
class << self
# Fetch random nationality
##
# Produces a random nationality.
#
# @return [String]
#
# @example
# Faker::Nation.nationality #=> "Nepalese"
#
# @faker.version 1.9.0
def nationality
fetch('nation.nationality')
end

# Fetch random national flag emoji
# rubocop:disable Style/AsciiComments

##
# Produces a random national flag emoji.
#
# @return [String]
#
# @example
# Faker::Nation.flag #=> "🇫🇮"
#
# @faker.version 1.9.0
def flag
sample(translate('faker.nation.flag')).pack('C*').force_encoding('utf-8')
end
# rubocop:enable Style/AsciiComments

# Fetch random language
##
# Produces a random national language.
#
# @return [String]
#
# @example
# Faker::Nation.language #=> "Nepali"
#
# @faker.version 1.9.0
def language
fetch('nation.language')
end

# Fetch random capital city
##
# Produces a random capital city.
#
# @return [String]
#
# @example
# Faker::Nation.capital_city #=> "Kathmandu"
#
# @faker.version 1.9.0
def capital_city
fetch('nation.capital_city')
end

# Fetch random natinal sport
##
# Produces a random national sport.
#
# @return [String]
#
# @example
# Faker::Nation.national_sport #=> "dandi biyo"
#
# @faker.version 1.9.0
def national_sport
fetch('team.sport')
end
Expand Down
48 changes: 48 additions & 0 deletions lib/faker/japanese_media/one_piece.rb
Expand Up @@ -4,26 +4,74 @@ module Faker
class JapaneseMedia
class OnePiece < Base
class << self
# Produces a character from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.character #=> "Monkey D. Luffy"
#
# @faker.version 1.8.5
def character
fetch('one_piece.characters')
end

# Produces a sea from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.sea #=> "East Blue"
#
# @faker.version 1.8.5
def sea
fetch('one_piece.seas')
end

# Produces an island from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.island #=> "Laftel"
#
# @faker.version 1.8.5
def island
fetch('one_piece.islands')
end

# Produces a location from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.location #=> "Foosha Village"
#
# @faker.version 1.8.5
def location
fetch('one_piece.locations')
end

# Produces a quote from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.quote #=> "ONE PIECE IS REAL!"
#
# @faker.version 1.8.5
def quote
fetch('one_piece.quotes')
end

# Produces an akuma no mi from One Piece.
#
# @return [String]
#
# @example
# Faker::JapaneseMedia::OnePiece.akuma_no_mi #=> "Gomu Gomu no Mi"
#
# @faker.version 1.8.5
def akuma_no_mi
fetch('one_piece.akumas_no_mi')
end
Expand Down
25 changes: 25 additions & 0 deletions lib/faker/movies/back_to_the_future.rb
Expand Up @@ -4,14 +4,39 @@ module Faker
class Movies
class BackToTheFuture < Base
class << self
# Produces a character from Back to the Future.
#
# @return [String]
#
# @example
# Faker::Movies::BackToTheFuture.character #=> "Marty McFly"
#
# @faker.version 1.8.5
def character
fetch('back_to_the_future.characters')
end

# Produces a date from Back to the Future.
#
# @return [String]
#
# @example
# Faker::Movies::BackToTheFuture.date #=> "November 5, 1955"
#
# @faker.version 1.8.5
def date
fetch('back_to_the_future.dates')
end

# Produces a quote from Back to the Future.
#
# @return [String]
#
# @example
# Faker::Movies::BackToTheFuture.quote
# #=> "Roads? Where we're going, we don't need roads."
#
# @faker.version 1.8.5
def quote
fetch('back_to_the_future.quotes')
end
Expand Down
25 changes: 25 additions & 0 deletions lib/faker/movies/ghostbusters.rb
Expand Up @@ -4,14 +4,39 @@ module Faker
class Movies
class Ghostbusters < Base
class << self
# Produces an actor from Ghostbusters.
#
# @return [String]
#
# @example
# Faker::Movies::Ghostbusters.actor #=> "Bill Murray"
#
# @faker.version 1.9.2
def actor
fetch('ghostbusters.actors')
end

# Produces a character from Ghostbusters.
#
# @return [String]
#
# @example
# Faker::Movies::Ghostbusters.character #=> "Dr. Egon Spengler"
#
# @faker.version 1.9.2
def character
fetch('ghostbusters.characters')
end

# Produces a quote from Ghostbusters.
#
# @return [String]
#
# @example
# Faker::Movies::Ghostbusters.quote
# #=> "I tried to think of the most harmless thing. Something I loved from my childhood. Something that could never ever possibly destroy us. Mr. Stay Puft!"
#
# @faker.version 1.9.2
def quote
fetch('ghostbusters.quotes')
end
Expand Down
48 changes: 48 additions & 0 deletions lib/faker/movies/harry_potter.rb
Expand Up @@ -4,26 +4,74 @@ module Faker
class Movies
class HarryPotter < Base
class << self
# Produces a character from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.character #=> "Harry Potter"
#
# @faker.version 1.7.3
def character
fetch('harry_potter.characters')
end

# Produces a location from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.location #=> "Hogwarts"
#
# @faker.version 1.7.3
def location
fetch('harry_potter.locations')
end

# Produces a quote from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.quote #=> "I solemnly swear that I am up to good."
#
# @faker.version 1.7.3
def quote
fetch('harry_potter.quotes')
end

# Produces a book from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.book #=> "Harry Potter and the Chamber of Secrets"
#
# @faker.version 1.7.3
def book
fetch('harry_potter.books')
end

# Produces a house from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.house #=> "Gryffindor"
#
# @faker.version 1.7.3
def house
fetch('harry_potter.houses')
end

# Produces a spell from Harry Potter.
#
# @return [String]
#
# @example
# Faker::Movies::HarryPotter.spell #=> "Reparo"
#
# @faker.version 1.7.3
def spell
fetch('harry_potter.spells')
end
Expand Down
62 changes: 62 additions & 0 deletions lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb
Expand Up @@ -4,30 +4,92 @@ module Faker
class Movies
class HitchhikersGuideToTheGalaxy < Base
class << self
# Produces a character from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.character #=> "Marvin"
#
# @faker.version 1.8.0
def character
fetch('hitchhikers_guide_to_the_galaxy.characters')
end

# Produces a location from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.location
# #=> "Arthur Dent's house"
#
# @faker.version 1.8.0
def location
fetch('hitchhikers_guide_to_the_galaxy.locations')
end

# Produces a Marvin quote from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.marvin_quote
# #=> "Life? Don't talk to me about life."
#
# @faker.version 1.8.0
def marvin_quote
fetch('hitchhikers_guide_to_the_galaxy.marvin_quote')
end

# Produces a planet from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.planet
# #=> "Magrathea"
#
# @faker.version 1.8.0
def planet
fetch('hitchhikers_guide_to_the_galaxy.planets')
end

# Produces a quote from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.quote
# #=> "In the beginning, the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
#
# @faker.version 1.8.0
def quote
fetch('hitchhikers_guide_to_the_galaxy.quotes')
end

# Produces a species from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.specie
# #=> "Perfectly Normal Beast"
#
# @faker.version 1.8.0
def specie
fetch('hitchhikers_guide_to_the_galaxy.species')
end

# Produces a starship from The Hitchhiker's Guide to the Galaxy.
#
# @return [String]
#
# @example
# Faker::Movies::HitchhikersGuideToTheGalaxy.starship
# #=> "Vogon Constructor Fleet"
#
# @faker.version 1.8.0
def starship
fetch('hitchhikers_guide_to_the_galaxy.starships')
end
Expand Down