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].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


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

def first_name
  fetch_sample(FIRST_NAMES)
end

#last_nameObject


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

def last_name
  fetch_sample(LAST_NAMES)
end

#nameObject


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

def name
  case rand(0..9)
  when 5, 7 then "#{prefix} #{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
  fetch_sample(PREFIX)
end