Class: Faker::Address

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/address.rb

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, flexible, letterify, method_missing, numerify, parse, translate

Class Method Details

.cityObject



6
7
8
# File 'lib/faker/address.rb', line 6

def city
  parse('address.city')
end

.city_prefixObject



30
# File 'lib/faker/address.rb', line 30

def city_prefix;   fetch('address.city_prefix');   end

.city_suffixObject



29
# File 'lib/faker/address.rb', line 29

def city_suffix;   fetch('address.city_suffix');   end

.countryObject Also known as: earth_country



33
# File 'lib/faker/address.rb', line 33

def country;       fetch('address.country');       end

.latitudeObject



35
36
37
# File 'lib/faker/address.rb', line 35

def latitude
  ((rand * 180) - 90).to_s
end

.longitudeObject



39
40
41
# File 'lib/faker/address.rb', line 39

def longitude
  ((rand * 360) - 180).to_s
end

.secondary_addressObject



18
19
20
# File 'lib/faker/address.rb', line 18

def secondary_address
  numerify(fetch('address.secondary_address'))
end

.stateObject Also known as: us_state



32
# File 'lib/faker/address.rb', line 32

def state;         fetch('address.state');         end

.state_abbrObject Also known as: us_state_abbr



31
# File 'lib/faker/address.rb', line 31

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_nameObject



10
11
12
# File 'lib/faker/address.rb', line 10

def street_name
  parse('address.street_name')
end

.street_suffixObject



28
# File 'lib/faker/address.rb', line 28

def street_suffix; fetch('address.street_suffix'); end

.uk_countyObject



48
# File 'lib/faker/address.rb', line 48

def uk_county; county; end

.zip_codeObject Also known as: zip, postcode, uk_postcode



22
23
24
# File 'lib/faker/address.rb', line 22

def zip_code
  bothify(fetch('address.postcode'))
end