Class: Faker::Relationship
- Defined in:
- lib/faker/default/relationship.rb
Constant Summary
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.familial(connection: nil) ⇒ String
Produces a random family relationship.
-
.in_law ⇒ String
Produces a random in-law relationship.
-
.parent ⇒ String
Produces a random parent relationship.
-
.sibling ⇒ String
Produces a random sibling relationship.
-
.spouse ⇒ String
Produces a random spouse relationship.
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
.familial(connection: nil) ⇒ String
Produces a random family relationship.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/faker/default/relationship.rb', line 17 def familial(connection: nil) familial_connections = translate('faker.relationship.familial').keys if connection.nil? connection = sample(familial_connections).to_s else connection = connection.to_s.downcase unless familial_connections.include?(connection.to_sym) raise ArgumentError, "Familial connections can be left blank or #{familial_connections.join(', ')}" end end fetch("relationship.familial.#{connection}") end |
.in_law ⇒ String
Produces a random in-law relationship.
43 44 45 |
# File 'lib/faker/default/relationship.rb', line 43 def in_law fetch('relationship.in_law') end |
.parent ⇒ String
Produces a random parent relationship.
69 70 71 |
# File 'lib/faker/default/relationship.rb', line 69 def parent fetch('relationship.parent') end |
.sibling ⇒ String
Produces a random sibling relationship.
82 83 84 |
# File 'lib/faker/default/relationship.rb', line 82 def sibling fetch('relationship.sibling') end |
.spouse ⇒ String
Produces a random spouse relationship.
56 57 58 |
# File 'lib/faker/default/relationship.rb', line 56 def spouse fetch('relationship.spouse') end |