PostalAddress
International postal address formatting
Installation
Add this line to your application's Gemfile:
gem 'postal_address'
And then execute:
$ bundle
Or install it yourself as:
$ gem install postal_address
Usage
address = {
recipient: 'Tobias Füncke',
street: '101 Broadway',
city: 'New York City',
zip: '10002',
state: 'NY',
country_code: 'us'
}
PostalAddress.new(address).to_s
Tobias F
Set a home country (country names are not display for those addresses)
PostalAddress.home_country = 'us'
p = PostalAddress.new(address)
p.to_html(tag: 'section', itemprop: 'address')
<section itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="name">Tobias F
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
