Class Faker::Base
In: lib/faker.rb
Parent: Object

Methods

Constants

Numbers = Array(0..9)
ULetters = Array('A'..'Z')
Letters = ULetters + Array('a'..'z')

Public Class methods

Helper for the common approach of grabbing a translation with an array of values and selecting one of them.

Helper for the common approach of grabbing a translation with an array of values and returning all of them.

You can add whatever you want to the locale file, and it will get caught here. E.g., in your locale file, create a

  name:
    girls_name: ["Alice", "Cheryl", "Tatiana"]

Then you can call Faker::Name.girls_name and it will act like first_name

make sure numerify results doesn’t start with a zero

Load formatted strings from the locale, "parsing" them into method calls that can be used to generate a formatted translation: e.g., "#{first_name} #{last_name}".

Generates a random value between the interval

Given a regular expression, attempt to generate a string that would match it. This is a rather simple implementation, so don‘t be shocked if it blows up on you in a spectacular fashion.

It does not handle ., *, unbounded ranges such as {1,}, extensions such as (?=), character classes, some abbreviations for character classes, and nested parentheses.

I told you it was simple. :) It‘s also probably dog-slow, so you shouldn‘t use it.

It will take a regex like this:

/^[A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}$/

and generate a string like this:

"U3V 3TP"

Call I18n.translate with our configured locale if no locale is specified

Executes block with given locale set.

[Validate]