Module: FFaker::AddressFR

Extended by:
AddressFR, ModuleUtils
Includes:
Address
Included in:
AddressFR
Defined in:
lib/ffaker/address_fr.rb

Constant Summary collapse

NUM =
['#', '##', '##', '###', '####', '#-##'].freeze
MOD =
[' B', ' T', ' Q', ' BIS', ' TER', ' QUATER', '', '', '', ''].freeze
SEP =
[', ', ' '].freeze
TYPE =
%w[rue avenue av boulevard bd impasse].freeze
POSTAL_CODE_FORMATS =
['#####', '97###', '2A###', '2B###'].freeze

Constants included from Address

FFaker::Address::CITY_PREFIXES, FFaker::Address::COMPASS_DIRECTIONS, FFaker::Address::SEC_ADDR

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from Address

#building_number, #city_prefix, #city_suffix, #country, #country_code, #neighborhood, #secondary_address, #street_name, #street_suffix, #time_zone, #uk_country, #uk_county, #uk_postcode, #us_state, #us_state_abbr, #zip_code

Instance Method Details

#cityObject


28
29
30
# File 'lib/ffaker/address_fr.rb', line 28

def city
  fetch_sample(CITY)
end

#full_addressObject


32
33
34
# File 'lib/ffaker/address_fr.rb', line 32

def full_address
  %(#{street_address}#{fetch_sample(SEP)}#{postal_code} #{fetch_sample(CITY)})
end

#postal_codeObject


24
25
26
# File 'lib/ffaker/address_fr.rb', line 24

def postal_code
  FFaker.numerify(fetch_sample(POSTAL_CODE_FORMATS))
end

#regionObject


36
37
38
# File 'lib/ffaker/address_fr.rb', line 36

def region
  fetch_sample(REGION)
end

#street_addressObject


16
17
18
19
20
21
22
# File 'lib/ffaker/address_fr.rb', line 16

def street_address
  FFaker.numerify(fetch_sample(NUM)) +
    fetch_sample(MOD) +
    fetch_sample(SEP) +
    fetch_sample(TYPE) + ' ' +
    FFaker::NameFR.name
end