-
-
Save Lvtran1987/d6322db131c037045184 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_by_address(query) | |
results = [] | |
search = query.downcase | |
contacts.each do |contact| | |
contact.addresses.each do |address| | |
if address.to_s('long').downcase.include?(search) | |
results.push(contact) unless results.include?(contact) | |
end | |
end | |
end | |
print_results("Address search results (#{search})", results) # Is print_results here in the public domain? | |
end | |
end | |
address_book = AddressBook.new | |
loi = Contact.new | |
loi.fname = "Loi" | |
loi.mname = "Van" | |
loi.lname = "Tran" | |
loi.add_phone_number("Home", "850-123-1234") | |
loi.add_phone_number("Work", "123-456-1234") | |
loi.add_address("Mansion", "First in the world lane two shot", "", "Miami", "FL", "12345") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment