Address Formatter in Ruby
In this guide you will learn how to take in an address as a hash and have it output a formatted string.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build out a method that will format addresses.
Exercise Description
"Define a method that will take in an address as a hash and output a formatted string."
Example Data
'address_data = { 'account': 'Google', 'street_one': '1600 Amphitheatre Parkway', 'street_two': nil, 'city': 'Mountain View', 'state': 'CA', 'postal_code': '94043' } formatted_address = <<~ADDRESS Google 1600 Amphitheatre Parkway Mountain View, CA 94043 ADDRESS' -> expect(AddressFormatter.format(address_data)).to eq(formatted_address)
Real World Usage
It will help gather data and disperse it in to a desired format.