Module: FFaker::NameES

Extended by:
ModuleUtils
Defined in:
lib/ffaker/name_es.rb

Constant Summary collapse

MALE_PREFIXES =
%w[D. Dr.].freeze
FEMALE_PREFIXES =
%w[D.ª Dra.].freeze
PREFIXES =
(MALE_PREFIXES + FEMALE_PREFIXES).freeze
FIRST_NAMES =
(FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze

Class Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Class Method Details

.female_name_with_prefixObject



28
29
30
# File 'lib/ffaker/name_es.rb', line 28

def female_name_with_prefix
  "#{female_prefix} #{first_name_female} #{last_name} #{last_name}"
end

.female_prefixObject



56
57
58
# File 'lib/ffaker/name_es.rb', line 56

def female_prefix
  fetch_sample(FEMALE_PREFIXES)
end

.first_nameObject



36
37
38
# File 'lib/ffaker/name_es.rb', line 36

def first_name
  fetch_sample(FIRST_NAMES)
end

.first_name_femaleObject



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

def first_name_female
  fetch_sample(FIRST_NAMES_FEMALE)
end

.first_name_maleObject



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

def first_name_male
  fetch_sample(FIRST_NAMES_MALE)
end

.last_nameObject



48
49
50
# File 'lib/ffaker/name_es.rb', line 48

def last_name
  fetch_sample(LAST_NAMES)
end

.male_name_with_prefixObject



32
33
34
# File 'lib/ffaker/name_es.rb', line 32

def male_name_with_prefix
  "#{male_prefix} #{first_name_male} #{last_name} #{last_name}"
end

.male_prefixObject



60
61
62
# File 'lib/ffaker/name_es.rb', line 60

def male_prefix
  fetch_sample(MALE_PREFIXES)
end

.nameObject

In Spain we use two surnames: The father’s and the mother’s



15
16
17
# File 'lib/ffaker/name_es.rb', line 15

def name
  "#{first_name} #{last_name} #{last_name}"
end

.name_with_prefixObject



19
20
21
22
23
24
25
26
# File 'lib/ffaker/name_es.rb', line 19

def name_with_prefix
  fetch_sample(
    [
      female_name_with_prefix,
      male_name_with_prefix
    ]
  )
end

.prefixObject



52
53
54
# File 'lib/ffaker/name_es.rb', line 52

def prefix
  fetch_sample(PREFIXES)
end