Module: Kovacs::Resources

Extended by:
Resources
Included in:
Resources
Defined in:
lib/kovacs/resources.rb

Instance Method Summary collapse

Instance Method Details

#forenames(nationality, sex) ⇒ Object



11
12
13
14
# File 'lib/kovacs/resources.rb', line 11

def forenames(nationality, sex)
  resource_path = "#{ Kovacs.root }/resources/#{ nationality }/#{ sex }_forename.txt"
  read_resource(resource_path)
end

#middle_names(nationality, sex) ⇒ Object



16
17
18
19
# File 'lib/kovacs/resources.rb', line 16

def middle_names(nationality, sex)
  resource_path = "#{ Kovacs.root }/resources/#{ nationality }/#{ sex }_forename.txt"
  read_resource(resource_path)
end

#nationalitiesObject



6
7
8
9
# File 'lib/kovacs/resources.rb', line 6

def nationalities
  resource_path = "#{ Kovacs.root }/resources"
  nationalities = Dir.glob(resource_path + '/*').select { |f| File.directory?(f) }.map { |s| s.split('/')[-1].to_sym }
end

#surnames(nationality) ⇒ Object



21
22
23
24
# File 'lib/kovacs/resources.rb', line 21

def surnames(nationality)
  resource_path = "#{ Kovacs.root }/resources/#{ nationality }/surname.txt"
  read_resource(resource_path)
end