Module: DataMaker::CN::Name

Extended by:
ModuleUtilities
Defined in:
lib/data_maker/cn/name.rb

Class Method Summary collapse

Methods included from ModuleUtilities

const_missing, k, underscore

Class Method Details

.first_name(number_of_characters = 2) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/data_maker/cn/name.rb', line 6

def self.first_name(number_of_characters = 2)
  if number_of_characters < 1 || number_of_characters > 2
    raise ArgumentError, "You can only pass 1 or 2" 
  end
  first_name = FIRST_NAMES.sample
  if number_of_characters < 2
    return first_name[0].slice(0)
  end
  first_name
end

.full_name(eastern_format = true, first_name_character_count = 2) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/data_maker/cn/name.rb', line 21

def self.full_name(eastern_format = true, first_name_character_count = 2)
  if first_name_character_count < 1 || first_name_character_count > 2
    raise ArgumentError, "You can only pass 1 or 2" 
  end
  full_name = []
  full_name << first_name(first_name_character_count)
  full_name << last_name
  eastern_format ? full_name.reverse : full_name
  full_name.join
end

.last_nameObject



17
18
19
# File 'lib/data_maker/cn/name.rb', line 17

def self.last_name
  LAST_NAMES.sample
end