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 YARD Docs for Faker::Demographic. #1848

Merged
merged 1 commit into from Dec 6, 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
57 changes: 57 additions & 0 deletions lib/faker/default/demographic.rb
Expand Up @@ -3,26 +3,83 @@
module Faker
class Demographic < Base
class << self
##
# Produces the name of a race.
#
# @return [String]
#
# @example
# Faker::Demographic.race #=> "Native Hawaiian or Other Pacific Islander"
#
# @faker.version 1.7.3
def race
fetch('demographic.race')
end

##
# Produces a level of educational attainment.
#
# @return [String]
#
# @example
# Faker::Demographic.educational_attainment #=> "GED or alternative credential"
#
# @faker.version 1.7.3
def educational_attainment
fetch('demographic.educational_attainment')
end

##
# Produces a denonym.
#
# @return [String]
#
# @example
# Faker::Demographic.denonym #=> "Panamanian"
#
# @faker.version 1.7.3
def demonym
fetch('demographic.demonym')
end

##
# Produces a marital status.
#
# @return [String]
#
# @example
# Faker::Demographic.marital_status #=> "Widowed"
#
# @faker.version 1.7.3
def marital_status
fetch('demographic.marital_status')
end

##
# Produces a sex for demographic purposes.
#
# @return [String]
#
# @example
# Faker::Demographic.sex #=> "Female"
#
# @faker.version 1.7.3
def sex
fetch('demographic.sex')
end

##
# Produces a height as a string.
#
# @param unit [Symbol] either `:metric` or `imperial`.
# @return [String]
#
# @example
# Faker::Demographic.height #=> "1.61"
# @example
# Faker::Demographic.height(unit: :imperial) #=> "6 ft, 2 in"
#
# @faker.version 1.7.3
def height(legacy_unit = NOT_GIVEN, unit: :metric)
warn_for_deprecated_arguments do |keywords|
keywords << :unit if legacy_unit != NOT_GIVEN
Expand Down