Class: Faker::Address
- Inherits:
-
Base
- Object
- Base
- Faker::Address
show all
- Defined in:
- lib/faker/address.rb
Constant Summary
Constants inherited
from Base
Base::Letters, Base::Numbers, Base::ULetters
Class Method Summary
collapse
Methods inherited from Base
bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate
Class Method Details
.building_number ⇒ Object
22
23
24
|
# File 'lib/faker/address.rb', line 22
def building_number
bothify(fetch('address.building_number'))
end
|
.city ⇒ Object
6
7
8
|
# File 'lib/faker/address.rb', line 6
def city
parse('address.city')
end
|
.city_prefix ⇒ Object
43
|
# File 'lib/faker/address.rb', line 43
def city_prefix; fetch('address.city_prefix'); end
|
.city_suffix ⇒ Object
42
|
# File 'lib/faker/address.rb', line 42
def city_suffix; fetch('address.city_suffix'); end
|
.country ⇒ Object
46
|
# File 'lib/faker/address.rb', line 46
def country; fetch('address.country'); end
|
.country_code ⇒ Object
47
|
# File 'lib/faker/address.rb', line 47
def country_code; fetch('address.country_code'); end
|
.latitude ⇒ Object
49
50
51
|
# File 'lib/faker/address.rb', line 49
def latitude
((rand * 180) - 90).to_s
end
|
.longitude ⇒ Object
53
54
55
|
# File 'lib/faker/address.rb', line 53
def longitude
((rand * 360) - 180).to_s
end
|
.secondary_address ⇒ Object
18
19
20
|
# File 'lib/faker/address.rb', line 18
def secondary_address
numerify(fetch('address.secondary_address'))
end
|
.state ⇒ Object
45
|
# File 'lib/faker/address.rb', line 45
def state; fetch('address.state'); end
|
.state_abbr ⇒ Object
44
|
# File 'lib/faker/address.rb', line 44
def state_abbr; fetch('address.state_abbr'); end
|
.street_address(include_secondary = false) ⇒ Object
14
15
16
|
# File 'lib/faker/address.rb', line 14
def street_address(include_secondary = false)
numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
end
|
.street_name ⇒ Object
10
11
12
|
# File 'lib/faker/address.rb', line 10
def street_name
parse('address.street_name')
end
|
.street_suffix ⇒ Object
41
|
# File 'lib/faker/address.rb', line 41
def street_suffix; fetch('address.street_suffix'); end
|
.time_zone ⇒ Object
34
35
36
|
# File 'lib/faker/address.rb', line 34
def time_zone
fetch('address.time_zone')
end
|
.zip_code(state_abbreviation = '') ⇒ Object
Also known as:
zip, postcode
26
27
28
29
30
31
32
|
# File 'lib/faker/address.rb', line 26
def zip_code(state_abbreviation = '')
return bothify(fetch('address.postcode')) if state_abbreviation === ''
bothify(fetch('address.postcode_by_state.' + state_abbreviation))
end
|