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.)

Constants included from Name

FFaker::Name::SUFFIXES

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Methods included from Name

#suffix

Instance Method Details

#any_nameObject



18
19
20
# File 'lib/ffaker/name_da.rb', line 18

def any_name
  name(:any)
end

#female_nameObject



26
27
28
# File 'lib/ffaker/name_da.rb', line 26

def female_name
  name(:female)
end

#first_name(gender = :any) ⇒ Object



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

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

#last_nameObject



40
41
42
# File 'lib/ffaker/name_da.rb', line 40

def last_name
  LAST_NAMES.sample
end

#male_nameObject



22
23
24
# File 'lib/ffaker/name_da.rb', line 22

def male_name
  name(:male)
end

#name(gender = :any) ⇒ Object



14
15
16
# File 'lib/ffaker/name_da.rb', line 14

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

#prefixObject



44
45
46
# File 'lib/ffaker/name_da.rb', line 44

def prefix
  PREFIXES.sample
end