Sha256: 069a45f9eeee193c75e6522900e66f0e62a2c1131feb2306a8915962d1224d7c
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
mydir = File.expand_path(File.dirname(__FILE__)) begin require 'psych' rescue LoadError end require 'i18n' I18n.load_path += Dir[File.join(mydir, 'locales', '*.yml')] I18n.reload! module Faker class Config def self.locale=(locale) I18n.locale = locale end end class Base class << self def numerify(number_string) number_string.gsub(/#/) { rand(10).to_s } end def letterify(letter_string) letter_string.gsub(/\?/) { ('a'..'z').to_a.rand } end def bothify(string) letterify(numerify(string)) end # Helper for the common approach of grabbing a translation with an array # of values and selecting one of them def fetch(key) I18n.translate("faker.#{key}").rand end end end end require 'faker/address' require 'faker/company' require 'faker/internet' require 'faker/lorem' require 'faker/name' require 'faker/phone_number' require 'faker/version' require 'faker/cli' require 'extensions/array'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faker19-1.0.0 | lib/faker.rb |