Module: FFaker::NameFR

Extended by:
ModuleUtils, NameFR
Included in:
NameFR
Defined in:
lib/ffaker/name_fr.rb

Overview

The names & first names in this module were found at this url github.com/fzaninotto/Faker/blob/master/src/Faker/Provider/fr_FR/Person.php

Constant Summary collapse

PREFIX =
%w[de du le].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#first_nameObject


22
23
24
# File 'lib/ffaker/name_fr.rb', line 22

def first_name
  fetch_sample(FIRST_NAMES)
end

#last_nameObject


18
19
20
# File 'lib/ffaker/name_fr.rb', line 18

def last_name
  fetch_sample(LAST_NAMES)
end

#nameObject


26
27
28
29
30
31
32
# File 'lib/ffaker/name_fr.rb', line 26

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

#prefixObject

randomized? (FRENCH) prefix!


14
15
16
# File 'lib/ffaker/name_fr.rb', line 14

def prefix
  fetch_sample(PREFIX)
end