Module: Faker::Name

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

Constant Summary collapse

PREFIXES =
k %w(Mr. Mrs. Ms. Miss Dr.)
SUFFIXES =
k %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



16
17
18
# File 'lib/ffakerer/name.rb', line 16

def first_name
  FIRST_NAMES.rand
end

#last_nameObject



20
21
22
# File 'lib/ffakerer/name.rb', line 20

def last_name
  LAST_NAMES.rand
end

#nameObject



8
9
10
11
12
13
14
# File 'lib/ffakerer/name.rb', line 8

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



24
25
26
# File 'lib/ffakerer/name.rb', line 24

def prefix
  PREFIXES.rand
end

#suffixObject



28
29
30
# File 'lib/ffakerer/name.rb', line 28

def suffix
  SUFFIXES.rand
end