Class: Faker::Demographic
Constant Summary
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.demonym ⇒ String
Produces a denonym.
-
.educational_attainment ⇒ String
Produces a level of educational attainment.
-
.height(unit: :metric) ⇒ String
Produces a height as a string.
-
.marital_status ⇒ String
Produces a marital status.
-
.race ⇒ String
Produces the name of a race.
-
.sex ⇒ String
Produces a sex for demographic purposes.
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale
Class Method Details
.demonym ⇒ String
Produces a denonym.
41 42 43 |
# File 'lib/faker/default/demographic.rb', line 41 def demonym fetch('demographic.demonym') end |
.educational_attainment ⇒ String
Produces a level of educational attainment.
28 29 30 |
# File 'lib/faker/default/demographic.rb', line 28 def educational_attainment fetch('demographic.educational_attainment') end |
.height(unit: :metric) ⇒ String
Produces a height as a string.
83 84 85 86 87 88 89 90 91 |
# File 'lib/faker/default/demographic.rb', line 83 def height(unit: :metric) case unit when :imperial inches = rand_in_range(57, 86) "#{inches / 12} ft, #{inches % 12} in" when :metric rand_in_range(1.45, 2.13).round(2).to_s end end |
.marital_status ⇒ String
Produces a marital status.
54 55 56 |
# File 'lib/faker/default/demographic.rb', line 54 def marital_status fetch('demographic.marital_status') end |
.race ⇒ String
Produces the name of a race.
15 16 17 |
# File 'lib/faker/default/demographic.rb', line 15 def race fetch('demographic.race') end |
.sex ⇒ String
Produces a sex for demographic purposes.
67 68 69 |
# File 'lib/faker/default/demographic.rb', line 67 def sex fetch('demographic.sex') end |