Module: Faker::String

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

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#from_regexp(exp) ⇒ Object



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

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

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

  result
end