Module: FFaker::NameNB

Extended by:
ModuleUtils, NameNB
Includes:
Name
Included in:
NameNB
Defined in:
lib/ffaker/name_nb.rb

Constant Summary collapse

PREFIXES =
%w[Dr. Prof.].freeze

Constants included from Name

FFaker::Name::FEMALE_PREFIXES, FFaker::Name::FIRST_NAMES, FFaker::Name::MALE_PREFIXES, FFaker::Name::OTHER_PREFIXES, FFaker::Name::SUFFIXES

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from Name

#female_name_with_prefix, #female_name_with_prefix_suffix, #female_name_with_suffix, #female_prefix, #html_safe_last_name, #html_safe_name, #male_name_with_prefix, #male_name_with_prefix_suffix, #male_name_with_suffix, #male_prefix, #name_with_prefix, #name_with_prefix_suffix, #name_with_suffix, #other_prefix, #pronouns, #suffix

Instance Method Details

#first_nameObject



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

def first_name
  case rand(0..11)
  when 0..4  then first_name_female
  when 5..9  then first_name_male
  when 10    then "#{first_name_male} #{first_name_male}"
  when 11    then "#{first_name_female} #{first_name_female}"
  end
end

#first_name_femaleObject



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

def first_name_female
  fetch_sample(FIRST_NAMES_FEMALE)
end

#first_name_maleObject



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

def first_name_male
  fetch_sample(FIRST_NAMES_MALE)
end

#last_nameObject



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

def last_name
  fetch_sample(LAST_NAMES)
end

#nameObject



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

def name
  case rand(0..29)
  when 0 then "#{prefix} #{first_name} #{last_name}"
  else        "#{first_name} #{last_name}"
  end
end

#prefixObject



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

def prefix
  fetch_sample(PREFIXES)
end