Module: FFaker::NameGR

Extended by:
ModuleUtils, NameGR
Included in:
NameGR
Defined in:
lib/ffaker/name_gr.rb

Overview

Author AntonyFalegkos<[email protected]> github.com/falegk

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#female_first_nameObject


52
53
54
# File 'lib/ffaker/name_gr.rb', line 52

def female_first_name
  fetch_sample(FEMALE_FIRST_NAMES)
end

#female_full_nameObject


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

def female_full_name
  "#{female_first_name} #{female_last_name}"
end

#female_last_nameObject


56
57
58
# File 'lib/ffaker/name_gr.rb', line 56

def female_last_name
  fetch_sample(FEMALE_LAST_NAMES)
end

#first_nameObject

Random first name (male or female)


29
30
31
32
33
34
# File 'lib/ffaker/name_gr.rb', line 29

def first_name
  case rand(0..1)
  when 0 then male_first_name
  when 1 then female_first_name
  end
end

#full_name(gender = :any) ⇒ Object Also known as: name

Random full name (male or female). Arguments :male, :female, :any


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

def full_name(gender = :any)
  case gender
  when :any then rand(0..1) == 0 ? male_full_name : female_full_name
  when :male then male_full_name
  when :female then female_full_name
  else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'
  end
end

#last_nameObject

Random last name (male or female)


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

def last_name
  case rand(0..1)
  when 0 then male_last_name
  when 1 then female_last_name
  end
end

#male_first_nameObject


44
45
46
# File 'lib/ffaker/name_gr.rb', line 44

def male_first_name
  fetch_sample(MALE_FIRST_NAMES)
end

#male_full_nameObject


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

def male_full_name
  "#{male_first_name} #{male_last_name}"
end

#male_last_nameObject


48
49
50
# File 'lib/ffaker/name_gr.rb', line 48

def male_last_name
  fetch_sample(MALE_LAST_NAMES)
end