Module: Faker

Extended by:
ModuleUtils
Defined in:
lib/ffakerer.rb,
lib/ffakerer/job.rb,
lib/ffakerer/ssn.rb,
lib/ffakerer/name.rb,
lib/ffakerer/time.rb,
lib/ffakerer/unit.rb,
lib/ffakerer/lorem.rb,
lib/ffakerer/movie.rb,
lib/ffakerer/skill.rb,
lib/ffakerer/venue.rb,
lib/ffakerer/job_fr.rb,
lib/ffakerer/ssn_se.rb,
lib/ffakerer/string.rb,
lib/ffakerer/address.rb,
lib/ffakerer/company.rb,
lib/ffakerer/name_cn.rb,
lib/ffakerer/name_cs.rb,
lib/ffakerer/name_da.rb,
lib/ffakerer/name_de.rb,
lib/ffakerer/name_fr.rb,
lib/ffakerer/name_ga.rb,
lib/ffakerer/name_ja.rb,
lib/ffakerer/name_kr.rb,
lib/ffakerer/name_mx.rb,
lib/ffakerer/name_ph.rb,
lib/ffakerer/name_ru.rb,
lib/ffakerer/name_se.rb,
lib/ffakerer/name_sn.rb,
lib/ffakerer/name_vn.rb,
lib/ffakerer/product.rb,
lib/ffakerer/internet.rb,
lib/ffakerer/lorem_ar.rb,
lib/ffakerer/lorem_cn.rb,
lib/ffakerer/lorem_fr.rb,
lib/ffakerer/education.rb,
lib/ffakerer/address_au.rb,
lib/ffakerer/address_ca.rb,
lib/ffakerer/address_da.rb,
lib/ffakerer/address_de.rb,
lib/ffakerer/address_mx.rb,
lib/ffakerer/address_se.rb,
lib/ffakerer/address_sn.rb,
lib/ffakerer/address_uk.rb,
lib/ffakerer/address_us.rb,
lib/ffakerer/company_se.rb,
lib/ffakerer/conference.rb,
lib/ffakerer/html_ipsum.rb,
lib/ffakerer/bacon_ipsum.rb,
lib/ffakerer/geolocation.rb,
lib/ffakerer/internet_se.rb,
lib/ffakerer/unit_metric.rb,
lib/ffakerer/dizzle_ipsum.rb,
lib/ffakerer/phone_number.rb,
lib/ffakerer/unit_english.rb,
lib/ffakerer/hipster_ipsum.rb,
lib/ffakerer/identification.rb,
lib/ffakerer/phone_number_au.rb,
lib/ffakerer/phone_number_da.rb,
lib/ffakerer/phone_number_de.rb,
lib/ffakerer/phone_number_mx.rb,
lib/ffakerer/phone_number_se.rb,
lib/ffakerer/phone_number_sg.rb,
lib/ffakerer/phone_number_sn.rb,
lib/ffakerer/healthcare_ipsum.rb,
lib/ffakerer/identification_es.rb,
lib/ffakerer/utils/array_utils.rb,
lib/ffakerer/utils/module_utils.rb,
lib/ffakerer/identification_es_cl.rb,
lib/ffakerer/identification_es_co.rb

Defined Under Namespace

Modules: Address, AddressAU, AddressCA, AddressDA, AddressDE, AddressMX, AddressSE, AddressSN, AddressUK, AddressUS, ArrayUtils, BaconIpsum, Company, CompanySE, Conference, DizzleIpsum, Education, Geolocation, HTMLIpsum, HealthcareIpsum, HipsterIpsum, Identification, IdentificationES, IdentificationESCL, IdentificationESCO, Internet, InternetSE, Job, JobFR, Lorem, LoremAR, LoremCN, LoremFR, ModuleUtils, Movie, Name, NameCN, NameCS, NameDA, NameDE, NameFR, NameGA, NameJA, NameKR, NameMX, NamePH, NameRU, NameSE, NameSN, NameVN, PhoneNumber, PhoneNumberAU, PhoneNumberDA, PhoneNumberDE, PhoneNumberMX, PhoneNumberSE, PhoneNumberSG, PhoneNumberSN, Product, SSN, SSNSE, Skill, String, Time, Unit, UnitEnglish, UnitMetric, Venue

Constant Summary collapse

VERSION =
"1.0.0"
BASE_LIB_PATH =
File.expand_path("..", __FILE__)
LETTERS =
k('a'..'z')

Class Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Class Method Details

.bothify(masks) ⇒ Object



25
26
27
# File 'lib/ffakerer.rb', line 25

def self.bothify(masks)
  letterify(numerify(masks))
end

.letterify(*masks) ⇒ Object



19
20
21
22
23
# File 'lib/ffakerer.rb', line 19

def self.letterify(*masks)
  mask = ArrayUtils.rand(masks.flatten)
  mask.gsub!(/\?/) { LETTERS.rand }
  mask
end

.numerify(*masks) ⇒ Object



13
14
15
16
17
# File 'lib/ffakerer.rb', line 13

def self.numerify(*masks)
  mask = ArrayUtils.rand(masks.flatten)
  mask.gsub!(/#/) { rand(10).to_s }
  mask
end