Method: Faker::Base.fetch_all

Defined in:
lib/faker.rb

.fetch_all(key) ⇒ Object

Helper for the common approach of grabbing a translation with an array of values and returning all of them.



102
103
104
105
106
107
108
109
110
# File 'lib/faker.rb', line 102

def fetch_all(key)
  fetched = translate("faker.#{key}")
  fetched = fetched.last if fetched.size <= 1
  if !fetched.respond_to?(:sample) && fetched.match(/^\//) and fetched.match(/\/$/) # A regex
    regexify(fetched)
  else
    fetched
  end
end