Class | Faker::Base |
In: |
lib/faker.rb
|
Parent: | Object |
Numbers | = | Array(0..9) |
ULetters | = | Array('A'..'Z') |
Letters | = | ULetters + Array('a'..'z') |
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
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}".
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"