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 Faker::Relationship YARD docs #1793

Merged
merged 7 commits into from Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions lib/faker/default/relationship.rb
Expand Up @@ -5,6 +5,15 @@ class Relationship < Base
flexible :relationship

class << self
##
# Produces a random family relationship.
#
# @return [String]
#
# @example
# Faker::Relationship.familial #=> "Grandfather"
#
# @faker.version 1.9.2
def familial(legacy_connection = NOT_GIVEN, connection: nil)
warn_for_deprecated_arguments do |keywords|
keywords << :connection if legacy_connection != NOT_GIVEN
Expand All @@ -26,18 +35,54 @@ def familial(legacy_connection = NOT_GIVEN, connection: nil)
fetch('relationship.familial.' + connection)
end

##
# Produces a random in-law relationship.
#
# @return [String]
#
# @example
# Faker::Relationship.in_law #=> "Brother-in-law"
#
# @faker.version 1.9.2
def in_law
fetch('relationship.in_law')
end

##
# Produces a random spouse relationship.
#
# @return [String]
#
# @example
# Faker::Relationship.spouse #=> "Husband"
#
# @faker.version 1.9.2
def spouse
fetch('relationship.spouse')
end

##
# Produces a random parent relationship.
#
# @return [String]
#
# @example
# Faker::Relationship.parent #=> "Father"
#
# @faker.version 1.9.2
def parent
fetch('relationship.parent')
end

##
# Produces a random sibling relationship.
#
# @return [String]
#
# @example
# Faker::Relationship.sibling #=> "Sister"
#
# @faker.version 1.9.2
def sibling
fetch('relationship.sibling')
end
Expand Down