Module: FFaker::AddressMX

Extended by:
AddressMX, ModuleUtils
Included in:
AddressMX
Defined in:
lib/ffaker/address_mx.rb

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#municipality(st_abbr = nil) ⇒ Object



25
26
27
28
29
# File 'lib/ffaker/address_mx.rb', line 25

def municipality(st_abbr = nil)
  st_abbr ||= state_abbr
  municipalities = Object.const_get("FFaker::AddressMX::#{st_abbr.upcase}")
  fetch_sample(municipalities)
end

#postal_codeObject



12
13
14
# File 'lib/ffaker/address_mx.rb', line 12

def postal_code
  FFaker.numerify('#####')
end

#stateObject



16
17
18
# File 'lib/ffaker/address_mx.rb', line 16

def state
  fetch_sample(STATE)
end

#state_abbr(st_name = nil) ⇒ Object



20
21
22
23
# File 'lib/ffaker/address_mx.rb', line 20

def state_abbr(st_name = nil)
  st_name ||= state
  STATE_ABBR[STATE.index(st_name)]
end

#zip_codeObject



8
9
10
# File 'lib/ffaker/address_mx.rb', line 8

def zip_code
  FFaker.numerify('#####')
end