Class: Populate
- Inherits:
-
Object
- Object
- Populate
- Defined in:
- lib/french_populate.rb
Instance Method Summary collapse
-
#GetCity ⇒ Object
Return a fake city.
-
#GetCountry ⇒ Object
Return a fake country.
-
#GetEmail ⇒ Object
INTERNET Return a fake email.
-
#GetFirstName ⇒ Object
Return a fake first name.
-
#GetFullAddress ⇒ Object
Return a fake full adsress (street number, street name, zipcode, city).
-
#GetFullInternationalAddress ⇒ Object
Return a fake full international address (street number, street name, zipcode, city, country).
-
#GetFullName ⇒ Object
Return a fake full name (firstname + name).
-
#GetLastName ⇒ Object
Return a fake last name.
-
#GetLongTitle ⇒ Object
Return a people title (long version.ex. “Monsieur”).
-
#GetShortTitle ⇒ Object
NAMES ## Return a people title (short version. ex. “Mr”).
-
#GetStreetName ⇒ Object
Return a fake street name.
-
#GetStreetNumber ⇒ Object
PLACES ## Return a fake street number.
-
#GetUniqueUsername ⇒ Object
Return a fake unique username.
-
#GetUsername ⇒ Object
Return a fake username.
-
#GetZipCode ⇒ Object
Return a fake zipcode.
Instance Method Details
#GetCity ⇒ Object
Return a fake city
62 63 64 |
# File 'lib/french_populate.rb', line 62 def GetCity $citiesBDD.sample end |
#GetCountry ⇒ Object
Return a fake country
67 68 69 |
# File 'lib/french_populate.rb', line 67 def GetCountry $countriesBDD.sample end |
#GetEmail ⇒ Object
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 |
#GetFirstName ⇒ Object
Return a fake first name
32 33 34 |
# File 'lib/french_populate.rb', line 32 def GetFirstName $namesBDD.sample.split("-").map(&:capitalize).join("-") end |
#GetFullAddress ⇒ Object
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 |
#GetFullInternationalAddress ⇒ Object
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 |
#GetFullName ⇒ Object
Return a fake full name (firstname + name)
37 38 39 |
# File 'lib/french_populate.rb', line 37 def GetFullName self.GetFirstName + " " + self.GetLastName end |
#GetLastName ⇒ Object
Return a fake last name
27 28 29 |
# File 'lib/french_populate.rb', line 27 def GetLastName $namesBDD.sample.split("-").map(&:capitalize).join("-") end |
#GetLongTitle ⇒ Object
Return a people title (long version.ex. “Monsieur”)
22 23 24 |
# File 'lib/french_populate.rb', line 22 def GetLongTitle self.longTitles.sample end |
#GetShortTitle ⇒ Object
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 |
#GetStreetName ⇒ Object
Return a fake street name
48 49 50 |
# File 'lib/french_populate.rb', line 48 def GetStreetName $streetsBDD.sample end |
#GetStreetNumber ⇒ Object
PLACES ## Return a fake street number
43 44 45 |
# File 'lib/french_populate.rb', line 43 def GetStreetNumber rand(1..150).to_s end |
#GetUniqueUsername ⇒ Object
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 |
#GetUsername ⇒ Object
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 |
#GetZipCode ⇒ Object
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 |