Class: ForgeryJa::Address
- Inherits:
-
Forgery::Address
- Object
- Forgery::Address
- ForgeryJa::Address
- Defined in:
- lib/forgery_ja/forgery_ja/address.rb
Class Method Summary collapse
-
.address_list(options = {}) ⇒ Hash
Returns AddressList in Japanese 日本語の住所のリストを生成して返します.
-
.city(options = {}) ⇒ String
Returns CityName in Japanese 郡市区を返します.
-
.full_address(options = {}) ⇒ String
Returns FullAddress in Japanese 完全な住所を返します.
-
.state(options = {}) ⇒ String
Returns StateName in Japanese 都道府県名を返します.
-
.street_name(options = {}) ⇒ String
Returns StreetName in Japanese 町名を返します.
-
.street_number ⇒ String
Returns StreetName in Japanese 番地を返します.
-
.zip(options = {}) ⇒ String
Returns Zipcode in Japanese 日本の郵便番号を返します.
Class Method Details
.address_list(options = {}) ⇒ Hash
Returns AddressList in Japanese
日本語の住所のリストを生成して返します
119 120 121 122 123 124 125 126 127 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 119 def self.address_list(={}) = {:state => true, :city => true, :street => true, :number => true}.merge() list = {} list[:state] = state(:to => ForgeryJa::ARRAY) if [:state] list[:city] = city(:to => ForgeryJa::ARRAY) if [:city] list[:street] = street_name(:to => ForgeryJa::ARRAY) if [:street] list[:number] = street_number if [:number] list end |
.city(options = {}) ⇒ String
Returns CityName in Japanese
郡市区を返します
dictionary file name : cities_ja
47 48 49 50 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 47 def self.city(={}) = ForgeryJa.() ForgeryJa.parse(dictionaries[:cities_ja].random, [:to]) end |
.full_address(options = {}) ⇒ String
Returns FullAddress in Japanese
完全な住所を返します
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 95 def self.full_address(={}) = {:blank => false}.merge(ForgeryJa.()) list = address_list() result = [] result = list[:state] if list[:state] result = list_merge(result, list[:city], [:blank]) result = list_merge(result, list[:street], [:blank]) result.collect!{|f| f + ([:blank] ? ' ':'') + list[:number] } if list[:number] [:to] == ForgeryJa::ARRAY ? result : result[[:to]] end |
.state(options = {}) ⇒ String
Returns StateName in Japanese
都道府県名を返します
dictionary file name : states_ja
32 33 34 35 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 32 def self.state(={}) = ForgeryJa.() ForgeryJa.parse(dictionaries[:states_ja].random, [:to]) end |
.street_name(options = {}) ⇒ String
Returns StreetName in Japanese
町名を返します
dictionary file name : streets_ja
62 63 64 65 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 62 def self.street_name(={}) = ForgeryJa.() ForgeryJa.parse(dictionaries[:streets_ja].random, [:to]) end |
.street_number ⇒ String
Returns StreetName in Japanese
番地を返します
format file name : streets_number_ja
75 76 77 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 75 def self.street_number formats[:street_number_ja].random.to_numbers end |
.zip(options = {}) ⇒ String
Returns Zipcode in Japanese
日本の郵便番号を返します
14 15 16 17 18 |
# File 'lib/forgery_ja/forgery_ja/address.rb', line 14 def self.zip(={}) = {:hyphen => true}.merge() format = ( [:hyphen] ? "###-####" : "#######" ) format.to_numbers end |