Module: FFaker::AddressMX

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

Constant Summary collapse

MUNICIPALITY =
{ 'AGS' => AGS, 'BC' => BC, 'BCS' => BCS, 'CAMP' => CAMP, 'CHIS' => CHIS,
'CHIH' => CHIH, 'COAH' => COAH, 'COL' => COL, 'DF' => DF, 'DGO' => DGO, 'GRO' => GRO,
'GTO' => GTO, 'HGO' => HGO, 'JAL' => JAL, 'MEX' => MEX, 'MICH' => MICH, 'MOR' => MOR,
'NL' => NL, 'NAY' => NAY, 'OAX' => OAX, 'PUE' => PUE, 'QR' => QR, 'QRO' => QRO, 'SLP' => SLP,
'SIN' => SIN, 'SON' => SON, 'TAB' => TAB, 'TAMPS' => TAMPS, 'TLAX' => TLAX, 'VER' => VER,
'YUC' => YUC, 'ZAC' => ZAC }.freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#municipality(st_abbr = nil) ⇒ Object


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

def municipality(st_abbr = nil)
  st_abbr ||= state_abbr
  MUNICIPALITY[st_abbr][rand(0...MUNICIPALITY[st_abbr].size)]
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