Module: FFaker::AddressBR

Extended by:
AddressBR, ModuleUtils
Includes:
Address
Included in:
AddressBR
Defined in:
lib/ffaker/address_br.rb

Constant Summary collapse

STREET_PREFIX =
%w[Rua Avenida Travessa Alameda].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_address, #street_name, #street_suffix, #time_zone, #uk_country, #uk_county, #uk_postcode, #us_state, #us_state_abbr

Instance Method Details

#cityObject


26
27
28
# File 'lib/ffaker/address_br.rb', line 26

def city
  fetch_sample(CITY)
end

#full_addressObject


41
42
43
# File 'lib/ffaker/address_br.rb', line 41

def full_address
  "#{street}, #{building_number}, #{city}, #{state}, Brazil"
end

#stateObject


18
19
20
# File 'lib/ffaker/address_br.rb', line 18

def state
  fetch_sample(STATE)
end

#state_abbrObject


22
23
24
# File 'lib/ffaker/address_br.rb', line 22

def state_abbr
  fetch_sample(STATE_ABBR)
end

#streetObject


34
35
36
37
38
39
# File 'lib/ffaker/address_br.rb', line 34

def street
  case rand(0..1)
  when 0 then "#{street_prefix} #{NameBR.name}"
  when 1 then "#{street_prefix} #{NameBR.first_name} #{NameBR.last_name} #{NameBR.last_name}"
  end
end

#street_prefixObject


30
31
32
# File 'lib/ffaker/address_br.rb', line 30

def street_prefix
  fetch_sample(STREET_PREFIX)
end

#zip_codeObject


14
15
16
# File 'lib/ffaker/address_br.rb', line 14

def zip_code
  FFaker.numerify '#####-###'
end