Module: FFaker::AddressUA

Extended by:
AddressUA, ModuleUtils
Included in:
AddressUA
Defined in:
lib/ffaker/address_ua.rb

Constant Summary collapse

POSTAL_CODE_FORMAT =
['#####'].freeze
BUILDING_NUMBER_FORMATS =
%w[## # ###].freeze
APPARTMENT_NUMBER_FORMATS =
%w[# ## ###].freeze

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

#appartment_numberObject



42
43
44
# File 'lib/ffaker/address_ua.rb', line 42

def appartment_number
  numerify_mask(APPARTMENT_NUMBER_FORMATS)
end

#building_numberObject



38
39
40
# File 'lib/ffaker/address_ua.rb', line 38

def building_number
  numerify_mask(BUILDING_NUMBER_FORMATS)
end

#cityObject



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

def city
  fetch_sample(CITY)
end

#countryObject



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

def country
  fetch_sample(COUNTRY)
end

#provinceObject



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

def province
  fetch_sample(PROVINCE)
end

#street_address(include_secondary = false) ⇒ Object



32
33
34
35
36
# File 'lib/ffaker/address_ua.rb', line 32

def street_address(include_secondary = false)
  str = +"#{street_name}, #{building_number}"
  str << ", кв. #{appartment_number}" if include_secondary
  str
end

#street_nameObject



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

def street_name
  "вул. #{fetch_sample(STREET)}"
end

#zip_codeObject



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

def zip_code
  numerify_mask(POSTAL_CODE_FORMAT, true)
end