Sha256: a3c6fad7f720fcc7fad688a717a4a89a318ef18692f7e3dfb191abc0fbc3c0e2

Contents?: true

Size: 718 Bytes

Versions: 4

Compression:

Stored size: 718 Bytes

Contents

module Faker
  VERSION = "1.32.1"

  require 'ffaker/utils/array_utils'
  require 'ffaker/utils/module_utils'

  extend ModuleUtils

  BASE_LIB_PATH = File.expand_path("..", __FILE__)

  LETTERS = [*'a'..'z']

  HEX = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F)

  def self.hexify(*masks)
    masks.flatten.sample.gsub(/#/) { HEX.sample }
  end

  def self.numerify(*masks)
    masks.flatten.sample.gsub(/#/) { rand(10).to_s }
  end

  def self.letterify(*masks)
    masks.flatten.sample.gsub(/\?/) { LETTERS.sample }
  end

  def self.bothify(masks)
    letterify(numerify(masks))
  end

  # Load all constants.
  Dir["#{BASE_LIB_PATH}/ffaker/*.rb"].sort.each do |f|
    require "ffaker/#{File.basename(f, '.rb')}"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/lib/ffaker.rb
ffaker-1.32.1 lib/ffaker.rb