1
0
mirror of https://github.com/askn/faker.git synced 2023-08-10 21:13:01 +03:00

add title

This commit is contained in:
Aşkın Gedik 2016-01-06 09:23:15 +02:00
parent 6f91a185ab
commit dc3095f20c
10 changed files with 27 additions and 9 deletions

View File

@ -96,6 +96,7 @@ Faker::Name.first_name
Faker::Name.last_name
Faker::Name.prefix
Faker::Name.suffix
Faker::Name.title
```
### Faker::PhoneNumber

View File

@ -65,6 +65,7 @@ puts Faker::Name.first_name
puts Faker::Name.last_name
puts Faker::Name.prefix
puts Faker::Name.suffix
puts Faker::Name.title
puts "\n\t### Faker::PhoneNumber\n\n"

View File

@ -13,4 +13,9 @@ module Faker
def self.bothify(string)
self.letterify(self.numerify(string))
end
def self.fetch(data)
d = data as Array
d.sample
end
end

View File

@ -6,7 +6,7 @@ module Faker
{% for data_type in %w(state state_abbr city_suffix city_prefix country street_suffix) %}
def self.{{data_type.id}}
Faker::Data["address"]["{{data_type.id}}"].sample
Faker.fetch(Data["address"]["{{data_type.id}}"])
end
{% end %}
@ -38,7 +38,7 @@ module Faker
end
def self.secondary_address
Faker.numerify(Faker::Data["address"]["secondary_address"].sample)
Faker.numerify(Faker.fetch(Data["address"]["secondary_address"]))
end
def self.postcode

View File

@ -5,7 +5,7 @@ module Faker
end
def self.suffix
Faker::Data["company"]["suffix"].sample
Faker.fetch(Data["company"]["suffix"])
end
Formats = [

View File

@ -26,6 +26,11 @@ module Faker
"last_name" => %w(Abbott Abernathy Abshire Adams Altenwerth Anderson Ankunding Armstrong Auer Aufderhar Bahringer Bailey Balistreri Barrows Bartell Bartoletti Barton Bashirian Batz Bauch Baumbach Bayer Beahan Beatty Bechtelar Becker Bednar Beer Beier Berge Bergnaum Bergstrom Bernhard Bernier Bins Blanda Blick Block Bode Boehm Bogan Bogisich Borer Bosco Botsford Boyer Boyle Bradtke Brakus Braun Breitenberg Brekke Brown Bruen Buckridge Carroll Carter Cartwright Casper Cassin Champlin Christiansen Cole Collier Collins Conn Connelly Conroy Considine Corkery Cormier Corwin Cremin Crist Crona Cronin Crooks Cruickshank Cummerata Cummings Dach D"Amore Daniel Dare Daugherty Davis Deckow Denesik Dibbert Dickens Dicki Dickinson Dietrich Donnelly Dooley Douglas Doyle DuBuque Durgan Ebert Effertz Eichmann Emard Emmerich Erdman Ernser Fadel Fahey Farrell Fay Feeney Feest Feil Ferry Fisher Flatley Frami Franecki Friesen Fritsch Funk Gaylord Gerhold Gerlach Gibson Gislason Gleason Gleichner Glover Goldner Goodwin Gorczany Gottlieb Goyette Grady Graham Grant Green Greenfelder Greenholt Grimes Gulgowski Gusikowski Gutkowski Gutmann Haag Hackett Hagenes Hahn Haley Halvorson Hamill Hammes Hand Hane Hansen Harber Harris Hartmann Harvey Hauck Hayes Heaney Heathcote Hegmann Heidenreich Heller Herman Hermann Hermiston Herzog Hessel Hettinger Hickle Hilll Hills Hilpert Hintz Hirthe Hodkiewicz Hoeger Homenick Hoppe Howe Howell Hudson Huel Huels Hyatt Jacobi Jacobs Jacobson Jakubowski Jaskolski Jast Jenkins Jerde Jewess Johns Johnson Johnston Jones Kassulke Kautzer Keebler Keeling Kemmer Kerluke Kertzmann Kessler Kiehn Kihn Kilback King Kirlin Klein Kling Klocko Koch Koelpin Koepp Kohler Konopelski Koss Kovacek Kozey Krajcik Kreiger Kris Kshlerin Kub Kuhic Kuhlman Kuhn Kulas Kunde Kunze Kuphal Kutch Kuvalis Labadie Lakin Lang Langosh Langworth Larkin Larson Leannon Lebsack Ledner Leffler Legros Lehner Lemke Lesch Leuschke Lind Lindgren Littel Little Lockman Lowe Lubowitz Lueilwitz Luettgen Lynch Macejkovic Maggio Mann Mante Marks Marquardt Marvin Mayer Mayert McClure McCullough McDermott McGlynn McKenzie McLaughlin Medhurst Mertz Metz Miller Mills Mitchell Moen Mohr Monahan Moore Morar Morissette Mosciski Mraz Mueller Muller Murazik Murphy Murray Nader Nicolas Nienow Nikolaus Nitzsche Nolan Oberbrunner O"Connell O"Conner O"Hara O"Keefe O"Kon Okuneva Olson Ondricka O"Reilly Orn Ortiz Osinski Pacocha Padberg Pagac Parisian Parker Paucek Pfannerstill Pfeffer Pollich Pouros Powlowski Predovic Price Prohaska Prosacco Purdy Quigley Quitzon Rath Ratke Rau Raynor Reichel Reichert Reilly Reinger Rempel Renner Reynolds Rice Rippin Ritchie Robel Roberts Rodriguez Rogahn Rohan Rolfson Romaguera Roob Rosenbaum Rowe Ruecker Runolfsdottir Runolfsson Runte Russel Rutherford Ryan Sanford Satterfield Sauer Sawayn Schaden Schaefer Schamberger Schiller Schimmel Schinner Schmeler Schmidt Schmitt Schneider Schoen Schowalter Schroeder Schulist Schultz Schumm Schuppe Schuster Senger Shanahan Shields Simonis Sipes Skiles Smith Smitham Spencer Spinka Sporer Stamm Stanton Stark Stehr Steuber Stiedemann Stokes Stoltenberg Stracke Streich Stroman Strosin Swaniawski Swift Terry Thiel Thompson Tillman Torp Torphy Towne Toy Trantow Tremblay Treutel Tromp Turcotte Turner Ullrich Upton Vandervort Veum Volkman Von VonRueden Waelchi Walker Walsh Walter Ward Waters Watsica Weber Wehner Weimann Weissnat Welch West White Wiegand Wilderman Wilkinson Will Williamson Willms Windler Wintheiser Wisoky Wisozk Witting Wiza Wolf Wolff Wuckert Wunsch Wyman Yost Yundt Zboncak Zemlak Ziemann Zieme Zulauf),
"prefix" => ["Mr.", "Mrs.", "Ms.", "Miss", "Dr."],
"suffix" => ["Jr.", "Sr.", "I", "II", "III", "IV", "V", "MD", "DDS", "PhD", "DVM"],
"title" => {
"descriptor" => ["Lead", "Senior", "Direct", "Corporate", "Dynamic", "Future", "Product", "National", "Regional", "District", "Central", "Global", "Customer", "Investor", "Dynamic", "International", "Legacy", "Forward", "Internal", "Human", "Chief", "Principal"],
"level" => ["Solutions", "Program", "Brand", "Security", "Research", "Marketing", "Directives", "Implementation", "Integration", "Functionality", "Response", "Paradigm", "Tactics", "Identity", "Markets", "Group", "Division", "Applications", "Optimization", "Operations", "Infrastructure", "Intranet", "Communications", "Web", "Branding", "Quality", "Assurance", "Mobility", "Accounts", "Data", "Creative", "Configuration", "Accountability", "Interactions", "Factors", "Usability", "Metrics"],
"job" => ["Supervisor", "Associate", "Executive", "Liason", "Officer", "Manager", "Engineer", "Specialist", "Director", "Coordinator", "Administrator", "Architect", "Analyst", "Designer", "Planner", "Orchestrator", "Technician", "Developer", "Producer", "Consultant", "Assistant", "Facilitator", "Agent", "Representative", "Strategist"],
},
},
"phone_number" => {
"formats" => ["###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-####", "(###)###-####", "1-###-###-####", "###.###.####", "###-###-#### x###", "(###)###-#### x###", "1-###-###-#### x###", "###.###.#### x###", "###-###-#### x####", "(###)###-#### x####", "1-###-###-#### x####", "###.###.#### x####", "###-###-#### x#####", "(###)###-#### x#####", "1-###-###-#### x#####", "###.###.#### x#####"],

View File

@ -5,7 +5,7 @@ module Faker
end
def self.free_email(name = nil)
[user_name(name), Data["internet"]["free_email"].sample].join("@")
[user_name(name), Faker.fetch(Data["internet"]["free_email"])].join("@")
end
def self.user_name(name = nil)
@ -29,7 +29,7 @@ module Faker
end
def self.domain_suffix
Data["internet"]["domain_suffix"].sample
Faker.fetch(Data["internet"]["domain_suffix"])
end
def self.ip_v4_address

View File

@ -2,7 +2,8 @@ module Faker
# Based on Perl"s Text::Lorem
class Lorem
def self.words(num = 3)
Faker::Data["lorem"]["words"].shuffle[0, num]
words = Data["lorem"]["words"] as Array
words.shuffle[0, num]
end
def self.sentence(word_count = 4)

View File

@ -1,15 +1,20 @@
module Faker
class Name
def self.name
Formats.sample.call.join(' ')
Formats.sample.call.join(" ")
end
{% for data_type in %w(first_name last_name prefix suffix) %}
def self.{{data_type.id}}
Faker::Data["name"]["{{data_type.id}}"].sample
Faker.fetch(Data["name"]["{{data_type.id}}"])
end
{% end %}
def self.title
title = Data["name"]["title"] as Hash
Faker.fetch(title["descriptor"]) + " " + Faker.fetch(title["level"]) + " " + Faker.fetch(title["job"])
end
def self.catch_phrase
[
["Adaptive", "Advanced", "Ameliorated", "Assimilated", "Automated", "Balanced", "Business-focused", "Centralized", "Cloned", "Compatible", "Configurable", "Cross-group", "Cross-platform", "Customer-focused", "Customizable", "Decentralized", "De-engineered", "Devolved", "Digitized", "Distributed", "Diverse", "Down-sized", "Enhanced", "Enterprise-wide", "Ergonomic", "Exclusive", "Expanded", "Extended", "Face to face", "Focused", "Front-line", "Fully-configurable", "Function-based", "Fundamental", "Future-proofed", "Grass-roots", "Horizontal", "Implemented", "Innovative", "Integrated", "Intuitive", "Inverse", "Managed", "Mandatory", "Monitored", "Multi-channelled", "Multi-lateral", "Multi-layered", "Multi-tiered", "Networked", "Object-based", "Open-architected", "Open-source", "Operative", "Optimized", "Optional", "Organic", "Organized", "Persevering", "Persistent", "Phased", "Polarised", "Pre-emptive", "Proactive", "Profit-focused", "Profound", "Programmable", "Progressive", "Public-key", "Quality-focused", "Reactive", "Realigned", "Re-contextualized", "Re-engineered", "Reduced", "Reverse-engineered", "Right-sized", "Robust", "Seamless", "Secured", "Self-enabling", "Sharable", "Stand-alone", "Streamlined", "Switchable", "Synchronised", "Synergistic", "Synergized", "Team-oriented", "Total", "Triple-buffered", "Universal", "Up-sized", "Upgradable", "User-centric", "User-friendly", "Versatile", "Virtual", "Visionary", "Vision-oriented"].sample,

View File

@ -1,7 +1,7 @@
module Faker
class PhoneNumber
def self.phone_number
Faker.numerify(Data["phone_number"]["formats"].sample)
Faker.numerify(Faker.fetch(Data["phone_number"]["formats"]))
end
end
end