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

change data

This commit is contained in:
Aşkın Gedik 2016-01-05 18:03:08 +02:00
parent 475d7312d8
commit 3319563262
8 changed files with 60 additions and 91 deletions

View File

@ -7,16 +7,10 @@ module Faker
end end
def self.letterify(letter_string) def self.letterify(letter_string)
letter_string.gsub(/\?/) { ("a".."z").to_a.rand } letter_string.gsub(/\?/) { ("a".."z").to_a.sample }
end end
def self.bothify(string) def self.bothify(string)
self.letterify(self.numerify(string)) self.letterify(self.numerify(string))
end end
end end
class Array
def rand
self.at(rand(self.size))
end
end

View File

@ -1,12 +1,12 @@
module Faker module Faker
class Address class Address
def self.zip_code def self.zip_code
Faker.numerify(["#####", "#####-####"].rand) Faker.numerify(["#####", "#####-####"].sample)
end end
{% for data_type in %w(state state_abbr city_suffix city_prefix country street_suffix) %} {% for data_type in %w(state state_abbr city_suffix city_prefix country street_suffix) %}
def self.{{data_type.id}} def self.{{data_type.id}}
Faker::Data["{{data_type.id}}"].rand Faker::Data["address"]["{{data_type.id}}"].sample
end end
{% end %} {% end %}
@ -16,14 +16,14 @@ module Faker
"%s %s" % [city_prefix, Name.first_name], "%s %s" % [city_prefix, Name.first_name],
"%s%s" % [Name.first_name, city_suffix], "%s%s" % [Name.first_name, city_suffix],
"%s%s" % [Name.last_name, city_suffix], "%s%s" % [Name.last_name, city_suffix],
].rand ].sample
end end
def self.street_name def self.street_name
[ [
->{ [Name.last_name, street_suffix].join(" ") }, ->{ [Name.last_name, street_suffix].join(" ") },
->{ [Name.first_name, street_suffix].join(" ") }, ->{ [Name.first_name, street_suffix].join(" ") },
].rand.call ].sample.call
end end
def self.street_address def self.street_address
@ -34,21 +34,18 @@ module Faker
->{ "##### %s" % street_name }, ->{ "##### %s" % street_name },
->{ "##### %s Apt. ###" % street_name }, ->{ "##### %s Apt. ###" % street_name },
->{ "##### %s Suite ###" % street_name }, ->{ "##### %s Suite ###" % street_name },
].rand.call) ].sample.call)
end end
def self.secondary_address def self.secondary_address
Faker.numerify([ Faker.numerify(Faker::Data["address"]["secondary_address"].sample)
"Apt. ###",
"Suite ###",
].rand)
end end
def self.postcode def self.postcode
Faker.bothify([ Faker.bothify([
->{ "??# #??" }, ->{ "??# #??" },
->{ "??## #??" }, ->{ "??## #??" },
].rand.call).upcase ].sample.call).upcase
end end
end end
end end

View File

@ -1,11 +1,11 @@
module Faker module Faker
class Company class Company
def self.name def self.name
Formats.rand.call Formats.sample.call
end end
def self.suffix def self.suffix
%w(Inc and\ Sons LLC Group).rand Faker::Data["company"]["suffix"].sample
end end
Formats = [ Formats = [

File diff suppressed because one or more lines are too long

View File

@ -5,11 +5,11 @@ module Faker
end end
def self.free_email(name = nil) def self.free_email(name = nil)
[user_name(name), %w(gmail.com yahoo.com hotmail.com).rand].join("@") [user_name(name), Data["internet"]["free_email"].sample].join("@")
end end
def self.user_name(name = nil) def self.user_name(name = nil)
return name.scan(/\w+/).shuffle.map(&.[0]).join(%w(. _).rand).downcase if name return name.scan(/\w+/).shuffle.map(&.[0]).join(%w(. _).sample).downcase if name
[ [
->{ Name.first_name.gsub(/\W/, "").downcase }, ->{ Name.first_name.gsub(/\W/, "").downcase },
->{ ->{
@ -17,7 +17,7 @@ module Faker
n.gsub(/\W/, "") n.gsub(/\W/, "")
}.join(".").downcase }.join(".").downcase
}, },
].rand.call ].sample.call
end end
def self.domain_name def self.domain_name
@ -29,15 +29,15 @@ module Faker
end end
def self.domain_suffix def self.domain_suffix
%w(co.uk com us ca biz info name).rand Data["internet"]["domain_suffix"].sample
end end
def self.ip_v4_address def self.ip_v4_address
[ [
(0..255).to_a.rand, (0..255).to_a.sample,
(0..255).to_a.rand, (0..255).to_a.sample,
(0..255).to_a.rand, (0..255).to_a.sample,
(0..255).to_a.rand, (0..255).to_a.sample,
].join('.') ].join('.')
end end
end end

View File

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

View File

@ -1,30 +1,20 @@
module Faker module Faker
class Name class Name
def self.name def self.name
Formats.rand.call.join(' ') Formats.sample.call.join(' ')
end end
def self.first_name {% for data_type in %w(first_name last_name prefix suffix) %}
Faker::Data["first_name"].rand def self.{{data_type.id}}
end Faker::Data["name"]["{{data_type.id}}"].sample
def self.last_name
Faker::Data["last_name"].rand
end
def self.prefix
%w(Mr. Mrs. Ms. Miss Dr.).rand
end
def self.suffix
%w(Jr. Sr. I II III IV V MD DDS PhD DVM).rand
end end
{% end %}
def self.catch_phrase 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"].rand, ["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,
["24 hour", "24/7", "3rd generation", "4th generation", "5th generation", "6th generation", "actuating", "analyzing", "assymetric", "asynchronous", "attitude-oriented", "background", "bandwidth-monitored", "bi-directional", "bifurcated", "bottom-line", "clear-thinking", "client-driven", "client-server", "coherent", "cohesive", "composite", "context-sensitive", "contextually-based", "content-based", "dedicated", "demand-driven", "didactic", "directional", "discrete", "disintermediate", "dynamic", "eco-centric", "empowering", "encompassing", "even-keeled", "executive", "explicit", "exuding", "fault-tolerant", "foreground", "fresh-thinking", "full-range", "global", "grid-enabled", "heuristic", "high-level", "holistic", "homogeneous", "human-resource", "hybrid", "impactful", "incremental", "intangible", "interactive", "intermediate", "leading edge", "local", "logistical", "maximized", "methodical", "mission-critical", "mobile", "modular", "motivating", "multimedia", "multi-state", "multi-tasking", "national", "needs-based", "neutral", "next generation", "non-volatile", "object-oriented", "optimal", "optimizing", "radical", "real-time", "reciprocal", "regional", "responsive", "scalable", "secondary", "solution-oriented", "stable", "static", "systematic", "systemic", "system-worthy", "tangible", "tertiary", "transitional", "uniform", "upward-trending", "user-facing", "value-added", "web-enabled", "well-modulated", "zero administration", "zero defect", "zero tolerance"].rand, ["24 hour", "24/7", "3rd generation", "4th generation", "5th generation", "6th generation", "actuating", "analyzing", "assymetric", "asynchronous", "attitude-oriented", "background", "bandwidth-monitored", "bi-directional", "bifurcated", "bottom-line", "clear-thinking", "client-driven", "client-server", "coherent", "cohesive", "composite", "context-sensitive", "contextually-based", "content-based", "dedicated", "demand-driven", "didactic", "directional", "discrete", "disintermediate", "dynamic", "eco-centric", "empowering", "encompassing", "even-keeled", "executive", "explicit", "exuding", "fault-tolerant", "foreground", "fresh-thinking", "full-range", "global", "grid-enabled", "heuristic", "high-level", "holistic", "homogeneous", "human-resource", "hybrid", "impactful", "incremental", "intangible", "interactive", "intermediate", "leading edge", "local", "logistical", "maximized", "methodical", "mission-critical", "mobile", "modular", "motivating", "multimedia", "multi-state", "multi-tasking", "national", "needs-based", "neutral", "next generation", "non-volatile", "object-oriented", "optimal", "optimizing", "radical", "real-time", "reciprocal", "regional", "responsive", "scalable", "secondary", "solution-oriented", "stable", "static", "systematic", "systemic", "system-worthy", "tangible", "tertiary", "transitional", "uniform", "upward-trending", "user-facing", "value-added", "web-enabled", "well-modulated", "zero administration", "zero defect", "zero tolerance"].sample,
["ability", "access", "adapter", "algorithm", "alliance", "analyzer", "application", "approach", "architecture", "archive", "artificial intelligence", "array", "attitude", "benchmark", "budgetary management", "capability", "capacity", "challenge", "circuit", "collaboration", "complexity", "concept", "conglomeration", "contingency", "core", "customer loyalty", "database", "data-warehouse", "definition", "emulation", "encoding", "encryption", "extranet", "firmware", "flexibility", "focus group", "forecast", "frame", "framework", "function", "functionalities", "Graphic Interface", "groupware", "Graphical User Interface", "hardware", "help-desk", "hierarchy", "hub", "implementation", "info-mediaries", "infrastructure", "initiative", "installation", "instruction set", "interface", "internet solution", "intranet", "knowledge user", "knowledge base", "local area network", "leverage", "matrices", "matrix", "methodology", "middleware", "migration", "model", "moderator", "monitoring", "moratorium", "neural-net", "open architecture", "open system", "orchestration", "paradigm", "parallelism", "policy", "portal", "pricing structure", "process improvement", "product", "productivity", "project", "projection", "protocol", "secured line", "service-desk", "software", "solution", "standardization", "strategy", "structure", "success", "superstructure", "support", "synergy", "system engine", "task-force", "throughput", "time-frame", "toolset", "utilisation", "website", "workforce"].rand, ["ability", "access", "adapter", "algorithm", "alliance", "analyzer", "application", "approach", "architecture", "archive", "artificial intelligence", "array", "attitude", "benchmark", "budgetary management", "capability", "capacity", "challenge", "circuit", "collaboration", "complexity", "concept", "conglomeration", "contingency", "core", "customer loyalty", "database", "data-warehouse", "definition", "emulation", "encoding", "encryption", "extranet", "firmware", "flexibility", "focus group", "forecast", "frame", "framework", "function", "functionalities", "Graphic Interface", "groupware", "Graphical User Interface", "hardware", "help-desk", "hierarchy", "hub", "implementation", "info-mediaries", "infrastructure", "initiative", "installation", "instruction set", "interface", "internet solution", "intranet", "knowledge user", "knowledge base", "local area network", "leverage", "matrices", "matrix", "methodology", "middleware", "migration", "model", "moderator", "monitoring", "moratorium", "neural-net", "open architecture", "open system", "orchestration", "paradigm", "parallelism", "policy", "portal", "pricing structure", "process improvement", "product", "productivity", "project", "projection", "protocol", "secured line", "service-desk", "software", "solution", "standardization", "strategy", "structure", "success", "superstructure", "support", "synergy", "system engine", "task-force", "throughput", "time-frame", "toolset", "utilisation", "website", "workforce"].sample,
].join(" ") ].join(" ")
end end
@ -32,9 +22,9 @@ module Faker
# Wordlist from http://dack.com/web/bullshit.html # Wordlist from http://dack.com/web/bullshit.html
def self.bs def self.bs
[ [
["implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace", "enable", "orchestrate", "leverage", "reinvent", "aggregate", "architect", "enhance", "incentivize", "morph", "empower", "envisioneer", "monetize", "harness", "facilitate", "seize", "disintermediate", "synergize", "strategize", "deploy", "brand", "grow", "target", "syndicate", "synthesize", "deliver", "mesh", "incubate", "engage", "maximize", "benchmark", "expedite", "reintermediate", "whiteboard", "visualize", "repurpose", "innovate", "scale", "unleash", "drive", "extend", "engineer", "revolutionize", "generate", "exploit", "transition", "e-enable", "iterate", "cultivate", "matrix", "productize", "redefine", "recontextualize"].rand, ["implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace", "enable", "orchestrate", "leverage", "reinvent", "aggregate", "architect", "enhance", "incentivize", "morph", "empower", "envisioneer", "monetize", "harness", "facilitate", "seize", "disintermediate", "synergize", "strategize", "deploy", "brand", "grow", "target", "syndicate", "synthesize", "deliver", "mesh", "incubate", "engage", "maximize", "benchmark", "expedite", "reintermediate", "whiteboard", "visualize", "repurpose", "innovate", "scale", "unleash", "drive", "extend", "engineer", "revolutionize", "generate", "exploit", "transition", "e-enable", "iterate", "cultivate", "matrix", "productize", "redefine", "recontextualize"].sample,
["clicks-and-mortar", "value-added", "vertical", "proactive", "robust", "revolutionary", "scalable", "leading-edge", "innovative", "intuitive", "strategic", "e-business", "mission-critical", "sticky", "one-to-one", "24/7", "end-to-end", "global", "B2B", "B2C", "granular", "frictionless", "virtual", "viral", "dynamic", "24/365", "best-of-breed", "killer", "magnetic", "bleeding-edge", "web-enabled", "interactive", "dot-com", "sexy", "back-end", "real-time", "efficient", "front-end", "distributed", "seamless", "extensible", "turn-key", "world-class", "open-source", "cross-platform", "cross-media", "synergistic", "bricks-and-clicks", "out-of-the-box", "enterprise", "integrated", "impactful", "wireless", "transparent", "next-generation", "cutting-edge", "user-centric", "visionary", "customized", "ubiquitous", "plug-and-play", "collaborative", "compelling", "holistic", "rich"].rand, ["clicks-and-mortar", "value-added", "vertical", "proactive", "robust", "revolutionary", "scalable", "leading-edge", "innovative", "intuitive", "strategic", "e-business", "mission-critical", "sticky", "one-to-one", "24/7", "end-to-end", "global", "B2B", "B2C", "granular", "frictionless", "virtual", "viral", "dynamic", "24/365", "best-of-breed", "killer", "magnetic", "bleeding-edge", "web-enabled", "interactive", "dot-com", "sexy", "back-end", "real-time", "efficient", "front-end", "distributed", "seamless", "extensible", "turn-key", "world-class", "open-source", "cross-platform", "cross-media", "synergistic", "bricks-and-clicks", "out-of-the-box", "enterprise", "integrated", "impactful", "wireless", "transparent", "next-generation", "cutting-edge", "user-centric", "visionary", "customized", "ubiquitous", "plug-and-play", "collaborative", "compelling", "holistic", "rich"].sample,
["synergies", "web-readiness", "paradigms", "markets", "partnerships", "infrastructures", "platforms", "initiatives", "channels", "eyeballs", "communities", "ROI", "solutions", "e-tailers", "e-services", "action-items", "portals", "niches", "technologies", "content", "vortals", "supply-chains", "convergence", "relationships", "architectures", "interfaces", "e-markets", "e-commerce", "systems", "bandwidth", "infomediaries", "models", "mindshare", "deliverables", "users", "schemas", "networks", "applications", "metrics", "e-business", "functionalities", "experiences", "web services", "methodologies"].rand, ["synergies", "web-readiness", "paradigms", "markets", "partnerships", "infrastructures", "platforms", "initiatives", "channels", "eyeballs", "communities", "ROI", "solutions", "e-tailers", "e-services", "action-items", "portals", "niches", "technologies", "content", "vortals", "supply-chains", "convergence", "relationships", "architectures", "interfaces", "e-markets", "e-commerce", "systems", "bandwidth", "infomediaries", "models", "mindshare", "deliverables", "users", "schemas", "networks", "applications", "metrics", "e-business", "functionalities", "experiences", "web services", "methodologies"].sample,
].join(" ") ].join(" ")
end end

View File

@ -1,30 +1,7 @@
module Faker module Faker
class PhoneNumber class PhoneNumber
def self.phone_number def self.phone_number
Faker.numerify(Formats.rand) Faker.numerify(Data["phone_number"]["formats"].sample)
end end
Formats = [
"###-###-####",
"(###)###-####",
"1-###-###-####",
"###.###.####",
"###-###-####",
"(###)###-####",
"1-###-###-####",
"###.###.####",
"###-###-#### x###",
"(###)###-#### x###",
"1-###-###-#### x###",
"###.###.#### x###",
"###-###-#### x####",
"(###)###-#### x####",
"1-###-###-#### x####",
"###.###.#### x####",
"###-###-#### x#####",
"(###)###-#### x#####",
"1-###-###-#### x#####",
"###.###.#### x#####",
]
end end
end end