Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/faker/default/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ def state
#
# @faker.version 0.3.0
def country
fetch('address.country')
countries = fetch_all('address.countries')
@country = countries.sample(random: Faker::Config.random)

@country[:name]
end

##
Expand Down Expand Up @@ -258,7 +261,8 @@ def country_name_to_code(name: 'united_states')
#
# @faker.version 1.4.0
def country_code
fetch('address.country_code')
return fetch("address.country_code") if @country.nil?
@country[:code]
end

##
Expand Down
Loading