Module: FFaker::Name

Extended by:
ModuleUtils, Name
Included in:
Name, NameCS, NameDA, NameDE, NameMX, NameNB, NameNL, NamePH, NameRU, NameSE
Defined in:
lib/ffaker/name.rb

Constant Summary collapse

PREFIXES =
%w(Mr. Mrs. Ms. Miss Dr.)
SUFFIXES =
%w(Jr. Sr. I II III IV V MD DDS PhD DVM)

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#first_nameObject


19
20
21
# File 'lib/ffaker/name.rb', line 19

def first_name
  FIRST_NAMES.sample
end

#last_nameObject


23
24
25
# File 'lib/ffaker/name.rb', line 23

def last_name
  LAST_NAMES.sample
end

#nameObject


11
12
13
14
15
16
17
# File 'lib/ffaker/name.rb', line 11

def name
  case rand(10)
  when 0 then "#{prefix} #{first_name} #{last_name}"
  when 1 then "#{first_name} #{last_name} #{suffix}"
  else        "#{first_name} #{last_name}"
  end
end

#prefixObject


27
28
29
# File 'lib/ffaker/name.rb', line 27

def prefix
  PREFIXES.sample
end

#suffixObject


31
32
33
# File 'lib/ffaker/name.rb', line 31

def suffix
  SUFFIXES.sample
end