Class: Faker::Name

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/name.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.female_first_nameObject Also known as: first_name_women, feminine_name


30
31
32
# File 'lib/faker/default/name.rb', line 30

def female_first_name
  fetch('name.female_first_name')
end

.first_nameObject


16
17
18
19
20
21
22
# File 'lib/faker/default/name.rb', line 16

def first_name
  if parse('name.first_name').empty?
    fetch('name.first_name')
  else
    parse('name.first_name')
  end
end

.initials(number: 3) ⇒ Object


49
50
51
# File 'lib/faker/default/name.rb', line 49

def initials(number: 3)
  (0...number).map { rand(65..90).chr }.join
end

.last_nameObject Also known as: middle_name


36
37
38
# File 'lib/faker/default/name.rb', line 36

def last_name
  parse('name.last_name')
end

.male_first_nameObject Also known as: first_name_men, masculine_name


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

def male_first_name
  fetch('name.male_first_name')
end

.nameObject


8
9
10
# File 'lib/faker/default/name.rb', line 8

def name
  parse('name.name')
end

.name_with_middleObject


12
13
14
# File 'lib/faker/default/name.rb', line 12

def name_with_middle
  parse('name.name_with_middle')
end

.prefixObject


41
42
43
# File 'lib/faker/default/name.rb', line 41

def prefix
  fetch('name.prefix')
end

.suffixObject


45
46
47
# File 'lib/faker/default/name.rb', line 45

def suffix
  fetch('name.suffix')
end