Method: Faker::Address.method_missing
- Defined in:
- lib/faker/address.rb
.method_missing(m, *args, &block) ⇒ Object
You can add whatever you want to the locale file, and it will get caught here… e.g., create a country_code array in your locale, then you can call #country_code and it will act like #country
52 53 54 55 56 57 58 59 |
# File 'lib/faker/address.rb', line 52 def method_missing(m, *args, &block) # Use the alternate form of translate to get a nil rather than a "missing translation" string if translation = I18n.translate(:faker)[:address][m] translation.respond_to?(:rand) ? translation.rand : translation else super end end |