Sha256: 85671b242fd97f209b624361de5294c71a351e1dcc77c0bf5295d794b88c4748

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

mydir = File.dirname(__FILE__)

begin
  require 'psych'
rescue LoadError
end

require 'i18n'
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
I18n.load_path += Dir[File.join(mydir, 'locales', '*.yml')]


module Faker
  class Config
    def self.locale=(locale)
      I18n.locale = locale
    end
  end
  
  class Base
    class << self
      def numerify(number_string)
        number_string.gsub(/#/) { rand(10).to_s }
      end
  
      def letterify(letter_string)
        letter_string.gsub(/\?/) { ('a'..'z').to_a.rand }
      end
  
      def bothify(string)
        letterify(numerify(string))
      end
      
      # Helper for the common approach of grabbing a translation with an array
      # of values and selecting one of them
      def fetch(key)
        I18n.translate("faker.#{key}").rand
      end
    end
  end
end

require 'faker/address'
require '#{mydir}/faker/career'
require 'faker/company'
require 'faker/internet'
require 'faker/lorem'
require 'faker/name'
require 'faker/phone_number'
require 'faker/version'


require 'extensions/array'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faker-fakeme-0.9.8 lib/faker.rb