Module: FFaker::NameIT

Extended by:
ModuleUtils, NameIT
Included in:
NameIT
Defined in:
lib/ffaker/name_it.rb

Overview

Author microspino<[email protected]> github.com/microspino

Constant Summary collapse

PREFIX =
%w(Sig. Sig.ra Sig.na Dr. Dott. Dott.ssa Prof. Prof.ssa)

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#first_nameObject


21
22
23
# File 'lib/ffaker/name_it.rb', line 21

def first_name
  FIRST_NAMES.sample
end

#last_nameObject


17
18
19
# File 'lib/ffaker/name_it.rb', line 17

def last_name
  LAST_NAMES.sample
end

#nameObject


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

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

#prefixObject

randomized? (ITALIAN) prefix!


13
14
15
# File 'lib/ffaker/name_it.rb', line 13

def prefix
  PREFIX.sample
end