Module: FFaker::String

Extended by:
ModuleUtils, String
Included in:
String
Defined in:
lib/ffaker/string.rb

Constant Summary collapse

BACKSLASH =
'\\'
DASH =
'-'
LOWERS =
Array('a'..'z').freeze
UPPERS =
Array('A'..'Z').freeze
LETTERS =
LOWERS + UPPERS
NUMBERS =
Array('0'..'9').freeze
WORD_CHARS =
LETTERS + NUMBERS + ['_']
SPACES =
[' ', "\t"].freeze
ESCAPEABLE_CHARS =
['\\', '/', '.', '(', ')', '[', ']', '{', '}'].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#from_regexp(exp) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/ffaker/string.rb', line 19

def from_regexp(exp)
  result = +''
  @last_token = nil

  # Drop surrounding /'s and split into characters
  tokens = exp.inspect[1...-1].chars
  result << process_token(tokens) until tokens.empty?

  result
end