Parent

Forgery::Address

Generates random address information.

Public Class Methods

city() click to toggle source

Gets a random city out of the ‘cities’ dictionary.

Forgery(:address).city
# => "Anaheim"

Forgery(:address).city
# => "Sacramento"
# File lib/forgery/forgery/address.rb, line 57
def self.city
  dictionaries[:cities].random.unextend
end
continent() click to toggle source

Gets a random continent out of the ‘continents’ dictionary.

Forgery(:address).continent
# => "Africa"

Forgery(:address).continent
# => "Europe"
# File lib/forgery/forgery/address.rb, line 146
def self.continent
  dictionaries[:continents].random.unextend
end
country() click to toggle source

Gets a random country out of the ‘countries’ dictionary.

Forgery(:address).country
# => "Uruguay"

Forgery(:address).country
# => "Romania"
# File lib/forgery/forgery/address.rb, line 134
def self.country
  dictionaries[:countries].random.unextend
end
phone() click to toggle source

Gets one of the formats from ‘phone_formats’ and converts it to numbers.

Forgery(:address).phone
# => "1-(416)185-8799"

Forgery(:address).phone
# => "1-(589)248-0418"
# File lib/forgery/forgery/address.rb, line 123
def self.phone
  formats[:phone].random.to_numbers
end
province() click to toggle source

Gets a random Canadian province or territory out of the ‘provinces’ dictionary.

Forgery(:address).province
# => "Ontario"

Forgery(:address).province
# => "Northwest Territories"
# File lib/forgery/forgery/address.rb, line 90
def self.province
  dictionaries[:provinces].random.unextend
end
province_abbrev() click to toggle source

Gets a random Canadian province or territory abbreviation out of the ‘province_abbrev’ dictionary.

Forgery(:address).province_abbrev
# => "ON"

Forgery(:address).province_abbrev
# => "NT"
# File lib/forgery/forgery/address.rb, line 101
def self.province_abbrev
  dictionaries[:province_abbrevs].random.unextend
end
state() click to toggle source

Gets a random state out of the ‘states’ dictionary.

Forgery(:address).state
# => "Mississippi"

Forgery(:address).state
# => "Minnesota"
# File lib/forgery/forgery/address.rb, line 68
def self.state
  dictionaries[:states].random.unextend
end
state_abbrev() click to toggle source

Gets a random state abbreviation out of the ‘state_abbrev’ dictionary.

Forgery(:address).state_abbrev
# => "GA"

Forgery(:address).state_abbrev
# => "TX"
# File lib/forgery/forgery/address.rb, line 79
def self.state_abbrev
  dictionaries[:state_abbrevs].random.unextend
end
street_address() click to toggle source

Gets a full street address, including street number, street name, and street suffix.

Forgery(:address).street_address
# => "92 West Circle"

Forgery(:address).street_address
# => "93265 Harper Lane"
# File lib/forgery/forgery/address.rb, line 46
def self.street_address
  "#{street_number} #{street_name} #{street_suffix}"
end
street_name() click to toggle source

Gets a random street name out of the ‘streets’ dictionary.

Forgery(:address).street_name
# => "Atwood"

Forgery(:address).street_name
# => "Fordem"
# File lib/forgery/forgery/address.rb, line 11
def self.street_name
  dictionaries[:streets].random.unextend
end
street_number() click to toggle source

Gets one of the formats from ‘street_number_formats’ and converts it to numbers.

Forgery(:address).street_number
# => 1

Forgery(:address).street_number
# => 1234
# File lib/forgery/forgery/address.rb, line 23
def self.street_number
  formats[:street_number].random.to_numbers
end
street_suffix() click to toggle source

Gets a random street suffix out of the ‘street_suffixes’ dictionary.

Forgery(:address).street_suffix
# => "Street"

Forgery(:address).street_suffix
# => "Parkway"
# File lib/forgery/forgery/address.rb, line 34
def self.street_suffix
  dictionaries[:street_suffixes].random.unextend
end
zip() click to toggle source

Gets one of the formats from ‘zip_formats’ and converts it to numbers.

Forgery(:address).zip
# => "52474"

Forgery(:address).zip
# => "66702-4349"
# File lib/forgery/forgery/address.rb, line 112
def self.zip
  formats[:zip].random.to_numbers
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.