Module: Faker::Config

Defined in:
lib/faker.rb

Class Method Summary collapse

Class Method Details

.localeObject



20
21
22
23
# File 'lib/faker.rb', line 20

def locale
  # Because I18n.locale defaults to :en, if we don't have :en in our available_locales, errors will happen
  Thread.current[:faker_config_locale] || (I18n.available_locales.include?(I18n.locale) ? I18n.locale : I18n.available_locales.first)
end

.locale=(new_locale) ⇒ Object



16
17
18
# File 'lib/faker.rb', line 16

def locale=(new_locale)
  Thread.current[:faker_config_locale] = new_locale
end

.own_localeObject



25
26
27
# File 'lib/faker.rb', line 25

def own_locale
  Thread.current[:faker_config_locale]
end

.randomObject



33
34
35
# File 'lib/faker.rb', line 33

def random
  Thread.current[:faker_config_random] || Random
end

.random=(new_random) ⇒ Object



29
30
31
# File 'lib/faker.rb', line 29

def random=(new_random)
  Thread.current[:faker_config_random] = new_random
end