Module: FFaker::NameUA

Extended by:
ModuleUtils, NameUA
Included in:
NameUA
Defined in:
lib/ffaker/name_ua.rb

Constant Summary collapse

FIRST_NAMES =
FIRST_NAMES_MALE + FIRST_NAMES_FEMALE
LAST_NAMES =
LAST_NAMES_MALE + LAST_NAMES_FEMALE
MIDDLE_NAMES =
MIDDLE_NAMES_MALE + MIDDLE_NAMES_FEMALE

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


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

def first_name
  fetch_sample(FIRST_NAMES)
end

#first_name_femaleObject


12
13
14
# File 'lib/ffaker/name_ua.rb', line 12

def first_name_female
  fetch_sample(FIRST_NAMES_FEMALE)
end

#first_name_maleObject


16
17
18
# File 'lib/ffaker/name_ua.rb', line 16

def first_name_male
  fetch_sample(FIRST_NAMES_MALE)
end

#last_nameObject


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

def last_name
  fetch_sample(LAST_NAMES)
end

#last_name_femaleObject


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

def last_name_female
  fetch_sample(LAST_NAMES_FEMALE)
end

#last_name_maleObject


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

def last_name_male
  fetch_sample(LAST_NAMES_MALE)
end

#middle_name_femaleObject


20
21
22
# File 'lib/ffaker/name_ua.rb', line 20

def middle_name_female
  fetch_sample(MIDDLE_NAMES_FEMALE)
end

#middle_name_maleObject


24
25
26
# File 'lib/ffaker/name_ua.rb', line 24

def middle_name_male
  fetch_sample(MIDDLE_NAMES_MALE)
end

#nameObject


44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ffaker/name_ua.rb', line 44

def name
  case rand(0..7)
  when 0 then first_name_male
  when 1 then first_name_female
  when 2 then "#{first_name_male} #{middle_name_male}"
  when 3 then "#{first_name_female} #{middle_name_male}"
  when 4 then "#{last_name_male} #{first_name_male}"
  when 5 then "#{last_name_female} #{first_name_female}"
  when 6 then "#{last_name_male} #{first_name_male} #{middle_name_male}"
  when 7 then "#{last_name_female} #{first_name_female} #{middle_name_female}"
  end
end