Module: FFaker::NameDA

Extended by:
ModuleUtils, NameDA
Includes:
Name
Included in:
NameDA
Defined in:
lib/ffaker/name_da.rb

Constant Summary collapse

PREFIXES =
%w[Hr. Fr. Dr. Prof.].freeze

Constants included from Name

FFaker::Name::FEMALE_PREFIXES, FFaker::Name::FIRST_NAMES, FFaker::Name::MALE_PREFIXES, FFaker::Name::OTHER_PREFIXES, FFaker::Name::SUFFIXES

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from Name

#female_name_with_prefix, #female_name_with_prefix_suffix, #female_name_with_suffix, #female_prefix, #first_name_female, #first_name_male, #html_safe_last_name, #html_safe_name, #male_name_with_prefix, #male_name_with_prefix_suffix, #male_name_with_suffix, #male_prefix, #name_with_prefix, #name_with_prefix_suffix, #name_with_suffix, #other_prefix, #pronouns, #suffix

Instance Method Details

#any_nameObject



16
17
18
# File 'lib/ffaker/name_da.rb', line 16

def any_name
  name(:any)
end

#female_nameObject



24
25
26
# File 'lib/ffaker/name_da.rb', line 24

def female_name
  name(:female)
end

#first_name(gender = :any) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/ffaker/name_da.rb', line 28

def first_name(gender = :any)
  case gender
  when :any then rand(0..1).zero? ? first_name(:male) : first_name(:female)
  when :male then fetch_sample(MALE_FIRST_NAMES)
  when :female then fetch_sample(FEMALE_FIRST_NAMES)
  else
    raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'
  end
end

#last_nameObject



38
39
40
# File 'lib/ffaker/name_da.rb', line 38

def last_name
  fetch_sample(LAST_NAMES)
end

#male_nameObject



20
21
22
# File 'lib/ffaker/name_da.rb', line 20

def male_name
  name(:male)
end

#name(gender = :any) ⇒ Object



12
13
14
# File 'lib/ffaker/name_da.rb', line 12

def name(gender = :any)
  generate_name(first_name(gender))
end

#prefixObject



42
43
44
# File 'lib/ffaker/name_da.rb', line 42

def prefix
  fetch_sample(PREFIXES)
end