Class: Populate

Inherits:
Object
  • Object
show all
Defined in:
lib/french_populate.rb

Instance Method Summary collapse

Instance Method Details

#GetCityObject

Return a fake city



62
63
64
# File 'lib/french_populate.rb', line 62

def GetCity
	$citiesBDD.sample
end

#GetCountryObject

Return a fake country



67
68
69
# File 'lib/french_populate.rb', line 67

def GetCountry
	$countriesBDD.sample
end

#GetEmailObject

INTERNET Return a fake email



83
84
85
# File 'lib/french_populate.rb', line 83

def GetEmail
	(self.GetFirstName + "." + self.GetLastName + "@" + $emailDNS.sample + "." + $emailExtension.sample).downcase
end

#GetFirstNameObject

Return a fake first name



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

def GetFirstName
	$namesBDD.sample.split("-").map(&:capitalize).join("-")
end

#GetFullAddressObject

Return a fake full adsress (street number, street name, zipcode, city)



72
73
74
# File 'lib/french_populate.rb', line 72

def GetFullAddress
	self.GetStreetNumber + " " + self.GetStreetName + " " + self.GetZipCode + " " + self.GetCity 
end

#GetFullInternationalAddressObject

Return a fake full international address (street number, street name, zipcode, city, country)



77
78
79
# File 'lib/french_populate.rb', line 77

def GetFullInternationalAddress
	self.GetFullAddress + ", " + self.GetCountry
end

#GetFullNameObject

Return a fake full name (firstname + name)



37
38
39
# File 'lib/french_populate.rb', line 37

def GetFullName
	self.GetFirstName + " " + self.GetLastName
end

#GetLastNameObject

Return a fake last name



27
28
29
# File 'lib/french_populate.rb', line 27

def GetLastName 
	$namesBDD.sample.split("-").map(&:capitalize).join("-")
end

#GetLongTitleObject

Return a people title (long version.ex. “Monsieur”)



22
23
24
# File 'lib/french_populate.rb', line 22

def GetLongTitle
	self.longTitles.sample
end

#GetShortTitleObject

NAMES ## Return a people title (short version. ex. “Mr”)



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

def GetShortTitle
	self.shortTitles.sample
end

#GetStreetNameObject

Return a fake street name



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

def GetStreetName
	$streetsBDD.sample
end

#GetStreetNumberObject

PLACES ## Return a fake street number



43
44
45
# File 'lib/french_populate.rb', line 43

def GetStreetNumber
	rand(1..150).to_s
end

#GetUniqueUsernameObject

Return a fake unique username



100
101
102
103
104
105
# File 'lib/french_populate.rb', line 100

def GetUniqueUsername
	tempNumber = rand(1..9)
	# If the number is pair... or impair
	tempNumber % 2 == 0 ? tempNumber = 2 : tempNumber = 3
	(self.GetFirstName.byteslice(1..tempNumber) + self.GetLastName.byteslice(1..tempNumber) + Time.now.to_i.to_s.byteslice(5..9)).downcase
end

#GetUsernameObject

Return a fake username



88
89
90
91
92
93
94
95
96
97
# File 'lib/french_populate.rb', line 88

def GetUsername
	tempNumber = rand(1..9)
	# If the number is pair... or impair
	tempNumber % 2 == 0 ? tempNumber = 2 : tempNumber = 3
	tempEndNumber = case tempNumber
		when 2 then 4
		when 3 then 2
	end
	(self.GetFirstName.byteslice(1..tempNumber) + self.GetLastName.byteslice(1..tempNumber) + self.GetZipCode.byteslice(1..tempEndNumber)).downcase
end

#GetZipCodeObject

Return a fake zipcode



53
54
55
56
57
58
59
# File 'lib/french_populate.rb', line 53

def GetZipCode
	zipcode = rand(1000..95999).to_s
	if zipcode.length == 4
		zipcode = "0" + zipcode
	end
	zipcode
end